Converting a Screen UV to a Projected UV in a Post Process

Well, I thought this would be easy, but as I’m learning knowledge of mesh-based shaders is not the same as knowledge of image effect shaders.

Basically what I have is a texture is being applied to a surface in a post processing effect.
The texture is using the screen position (scaled by depth) as it’s UV coordinates.

How can I make these UV coordinates appear as if they’re projected into the scene and not just a billboard facing the camera.

This image will better explain what I’m trying to achieve:
7088959--844129--Perspective Correction.png

This is a small part of a larger effect so this needs to happen in the post processing effect and can’t be done any other way.

The short answer is: you can’t.*

  • At least not without having some kind of surface you’re calculating.The longer answer is you already have the solution to this problem from the solution in the other thread and just don’t realize it. You’re calculating a virtual plane in the shader. In calculating the plane, you’re calculating a world position for that plane. Those are also your UVs.