I wish to display a full screen texture onto a quad (an actual object in the scene). The texture must stay locked to the viewport and the only window to it would be that quad. Think of the quad as a green screen for displaying that texture.
Every frame I do:
- Transform every vertex from the quad into world space by using the quad’s transform function TransformPoint
- Transform every resulting vertex into screen space by using the camera’s WorldToScreenPoint function.
- Map the screen coordinates into UV space by dividing them by the screen’s dimensions (0.0->1.0).
- Use these normalized screen points as new UVs for the original vertices (minus the z).
Now the problem is that I get unexpected results with the texture not looking sharp when it should have been rendered at the screen resolution, and more so it looks (and animates) quite wrong. Any ideas about the algorithm?
Bunny83
2
Well, that doesn’t work like a green screen since you still render your quad in worldspace. So if the quad is tilted it will be rendered with perspective. What you want to do is either:
- render another quad in screen space that matches your 4 screenspace corners
- use an approach like green screen by first rendering your screen space texture as background, then render your masking quad with a depth mask shader and finally render your normal scene.