Semi-transparent shader with groups

Hi guys,

Can someone please advice if it is possible to make objects with this see-through shader to stay on top of another mesh if sprite.renderingGroupId >mesh.renderingGroupId ?

Lines 88-93

What are you trying to achieve exactly? What should be the right rendering from the PG?

Just trying to make it respect the render order set by id and become fully opaque when its above another mesh in order.

I guess the shader code is preventing this, so i’m wondering if there is something I could tweak in the shader itself to achieve it, or maybe I’m missing some other solution

This cannot work because the technique relies on the sprite and other objects being rendered in the same pass and using the same depth buffer.

When a sprite is rendered (after the opaque objects, because it is transparent), the depth buffer must have been filled with the depth of the opaque object. If you put a sprite in group 0 and the opaque objects in group 1, the depth buffer will be empty when the sprite is rendered and the output will not be as expected.

I don’t see how to make this work…

2 Likes

Thank you for your analysis, appreciate it.