I’m trying to solve a problem getting these three systems to play together nicely and I’m hoping someone might have some advice.
I have a UI element, placed in the world that moves with a character. I am using TAA and the UI element shows far too much ghosting/tearing along its edges if it uses a Translucent material. I’ve turned on Responsive AA but that has not made an appreciable difference. Fortunately I am able to significantly improve this by switching the material to use Masked blending.
Unfortunately I recently turned on Contact Shadows, which work great for the rest of the game, but interact with the UI material in an unintended fashion. Because I’m using Masked blending, it’s writing to the depth buffer, causing the raycasting for the Contact Shadows to pick up the UI and create a shadow from it (irregardless of shadow casting settings on the mesh and the fact that the material is set to Unlit). The shadow is very undesirable and if I can’t get rid of it I won’t be able to use Contact Shadows.
I tried improving the TAA’s effect on translucency but had little success with this. For example I tried a Translucent material that worked as a masked material, clamping the alpha to 0 or 1, and that did nothing.
I looked at the code in ShadowRayCast that does the raycasting for the Contact Shadows thinking that I could ignore unlit pixels but I couldn’t see a way to get the GBuffer data from there for arbitrary pixels and realized that this wouldn’t work anyway for a number of cases.
I looked for a way to simply set the Masked material to not write to depth (a feature I would generally expect) but there is nothing in the Editor to do this and looking through the code it was not obvious how I might add that.
Does anyone have any other ideas?