Hello!
I'm not sure if this is a runtime question exactly, but it seemed like the best place to ask. I've been integrating the spine-c++ runtime into my personal engine. I use Metal to render on iOS. I've exported with pre-multiplied alpha unchecked, and then setup the renderer to match. But I'm still seeing darkness being added wherever there is transparency.
Here's what it looks like in spine (left) vs how it renders in game (right). This guy has a thick glowing semi-transparent border, but for most other assets the issue manifests as a thin black outline.
Here are my texture packer settings:
And here's how my MTLRenderPipelineDescriptor is setup:
blendingEnabled = YES;
rgbBlendOperation = MTLBlendOperationAdd;
alphaBlendOperation = MTLBlendOperationAdd;
sourceRGBBlendFactor = MTLBlendFactorSourceAlpha;
sourceAlphaBlendFactor = MTLBlendFactorSourceAlpha;
destinationRGBBlendFactor = MTLBlendFactorOneMinusSourceAlpha;
destinationAlphaBlendFactor = MTLBlendFactorOneMinusSourceAlpha;
Thanks for any help!
1. sayfa (Toplam 1 sayfa)
eglynum
Bu mesaja eklenen dosyaları görüntülemek için gerekli yetkilere sahip değilsiniz.
1 year ago
- eglynum
- Mesajlar: 6
Mario
The artifacts you describe are the reason to use pre-multiplied alpha. Your blend settings are correct for non-PMA, but the artifcats are unavoidable. I suggest you use PMA. Have a look at the WebGL blend state setup for PMA as a reference. These should translate easily to Metal. https://github.com/EsotericSoftware/spine-runtimes/blob/4.0/spine-ts/spine-webgl/src/WebGL.ts#L77
1 year ago
-
Mario - Mesajlar: 3277
eglynum
Thanks for the response. I'm still not sure what the problem is exactly, but somehow alphas are getting pre-multiplied after I add the png to my xcode project. A response on an Apple forum mentioned that the "Compress PNG Files" build setting in xcode will modify the png to have pre-multiplied alpha, but I tried setting that to "No" and it didn't help. Anyway, I'm just removing alpha from rgb in the fragment shader for now.
Side note: I had a similar response written out yesterday, but the forum timed-out my login by then so it was deleted. What's with the 1990's behavior on this forum?
Side note: I had a similar response written out yesterday, but the forum timed-out my login by then so it was deleted. What's with the 1990's behavior on this forum?
1 year ago
- eglynum
- Mesajlar: 6
Mark topic unread
• 1. sayfa (Toplam 1 sayfa)
Dön Runtimes
- Tüm zamanlar UTC