Stride Z sort for alpha

hi all,

I need to display sg like this. a linear spread on z holding multiple pngs, phasing front or back. items should be able to fade in and out.

I know alpha blend should work with z ordered items. I tried ordering them, as suggested in this thread, but I still get alpha errors. I also tried the stride pbr pipeline. Interestingly alpha seems to work here too, but my images no not fade out completely.

tests.zip (2.9 MB)

unfortunately, this cannot work correctly with current 3d hardware, there will always be cases where you will see flips because the ordering depends on the object center. here is some more info:

and:

also, ordering entities doesn’t change anything, they are order-independent and get traversed after the scenegraph is built. but if they have transparency set, they will be ordered by distance to the camera automatically by the render engine. you don’t have to do that yourself. you only need to do that if you are using custom rendering.

another thing is that stride assumes premultiplied colors, so in your shader, multiply the colors with the alpha value like so:

float4 Filter(float4 tex0col)
{
    tex0col.a = tex0col.a * alpha;
    tex0col.rgb *= tex0col.a;
    return tex0col;
}

then it works with the TextureMaterial node:

image

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.