Shadows on alpha clipping/vertex offset shaders misaligned when using screen space texture
Hi all!
I am rendering two meshes (via a command buffer) to a RenderTexture, which I am using in several shaders to move vertices or do transparent cutouts on objects. Everything is great.
The problem happens in the shadow pass. Since I am comparing the object's vertex position with a screen space texture, the shadows are being drawn wrong. This is, I assume, because the shadow texture is generated from a orthographic camera at a different angle.
Some pictures to demonstrate:
The screen position node essentially takes the vertex position, multiplies it by the ObjectToClipPos matrix, and divides by the W component. Masking the XY component gives us the
Should I be sending the renderTexture's camera's viewProjectMatrix to a shader global and use that in some way to offset the viewport texture based on the camera that is currently rendering?
Any thoughts would be greatly appreciated!
Your answer
Follow this Question
Related Questions
Remove circular shadow from object 1 Answer
Shadows on Custom Lit Surface Shader 1 Answer
Artifacts Shader Graph vertex colors 0 Answers
[URP] Transp Shadergraph has shadows? 2 Answers