Hi all, I’m trying to render a portal using stencil buffer/mask, NOT with the commonly-used SceneCapture component. The motive is:
- The portan rendering should be identical with the world rendering including all lighting & shadow & post effects.
- SceneCapture approach is too expensive (especially with the large render target) and with many visual discrepancies from the main rendering pass.
The approach I would like to take is essentially:
- Render the base scene while marking the stencil buffer for pixels of a portal.
- Render the portal scene only to the marked pixels from Pass 1.
- Apply postprocessing.
This will be much more efficient and clear than SceneCapture approach. Now the question is how to achieve it, obviously.
Q1. How can I customize ALL existing surface shaders to use a new stencil state? Do I need to duplicate all existing PSOes to include a new stencil state? Or is it enough to inject a new SetDepthStencilState somewhere? If latter, where is that somewhere going to be (in C++)?
Q2. How can I kick of the main rendering pass with a different camera angle? I imagine it’s a little deviation from the local split-screen, because that’s what the splitscreen is doing already. Which C++ codes should I be checking to get an idea?
Thanks for any tips and help!