URP Lit shader with simple forward transparency?

Hi Everyone,

Is there a simple URP lit shader that just allows transparency through the color.A channel?

When I set Surface Type to Transparent (blending mode alpha) to achieve this I get strange “face fighting” that borks the object. However I am able to scale the transparency through color.A.

If I change blend mode to Additive the model looks better but now cannot be completely opaque.

In any case when the shader has been set to transparent, it can be manipulated by shaders behind it and lose opacity.

I just need to be able to set transparency to X%

This seems like a pretty generic task, there must be a URP shader somewhere that does this surely.



As explained in this discussion, transparent materials don’t write to the depth buffer and individual faces are not sorted, mainly for performance reasons. there may be a way to “fix” this in a shader (here someone did it with the standard shader, apparently), but one way that would also work in this case would be to split the model into multiple objects (one for each of the “boxy” shapes it is made of) and place each object’s origin in its center. If this is done in such a way that no objects can overlap with themselves (ideally each object is convex), the objects are sorted correctly and alpha transparency works as expected, including when the alpha is set to fully opaque.

See this comparison, where both models use the same material, but the left one is a single object, while the right one is split into four: