You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I implemented "order independent linked list transparency" with the guidance of the Vulkan sample. In our engine, we have different transparency modes, linked list transparency was supposed to be our newest one. Since we have a lot of integration tests, I noticed that with the linked list transparency, the blended colors are completely different, almost inverted. The blending function provided in oit_linked_lists/combine.frag seemed strange to me, especially that there is a need to invert the resulting accumulated alpha in line 141. The blending operations for our Combine pass are the following (which seem to me like they basic premultiplied alpha blending):
blend op: Add
Color blend factors (eSrcAlpha, eOneMinusSrcAlpha)
Alpha blend factors (eOne, eOneMinusSrcAlpha)
To fix the compositing, I had to switch up the blending function in combine.frag to this:
color needs to be initialized like this: vec4 color = vec4(0.0f, 0.0f, 0.0f, 0.0f);
and the alpha inversion in line 141 can be removed. With these changes, the resulting colors are the same as with basic transparency rendering.
I guess for the sample, it's not a problem if the blending is off, but for anyone using your sample as reference, it could lead to unnecessary problem solving. Just a suggestion :)
The text was updated successfully, but these errors were encountered:
I implemented "order independent linked list transparency" with the guidance of the Vulkan sample. In our engine, we have different transparency modes, linked list transparency was supposed to be our newest one. Since we have a lot of integration tests, I noticed that with the linked list transparency, the blended colors are completely different, almost inverted. The blending function provided in oit_linked_lists/combine.frag seemed strange to me, especially that there is a need to invert the resulting accumulated alpha in line 141. The blending operations for our Combine pass are the following (which seem to me like they basic premultiplied alpha blending):
To fix the compositing, I had to switch up the blending function in combine.frag to this:
`vec4 blendColors(vec4 srcColor, vec4 dstColor)
{
float alphaResult = srcColor.a + dstColor.a * (1.0f - srcColor.a);
vec3 rgbResult = (srcColor.rgb * srcColor.a + dstColor.rgb * dstColor.a * (1.0f - srcColor.a)) / alphaResult;
}`
color needs to be initialized like this:
vec4 color = vec4(0.0f, 0.0f, 0.0f, 0.0f);
and the alpha inversion in line 141 can be removed. With these changes, the resulting colors are the same as with basic transparency rendering.
I guess for the sample, it's not a problem if the blending is off, but for anyone using your sample as reference, it could lead to unnecessary problem solving. Just a suggestion :)
The text was updated successfully, but these errors were encountered: