I’m working on a project where I need to render the scene from a different ViewOrigin
without affecting the main camera view. My goal is to set up a secondary view that renders the scene from an alternate location and orientation (Without SceneCapture2D), and then access its SceneTextures
(like SceneColor
and SceneDepth
) directly within the rendering pipeline.
What I’m Trying to Achieve:
- Render a Secondary View:
- Create a new view that renders the scene from a different
ViewOrigin
andViewRotation
. - Ensure that this secondary view does not interfere with or alter the main camera’s rendering.
- Create a new view that renders the scene from a different
- Access SceneTextures of the Secondary View:
- Retrieve the
SceneColor
andSceneDepth
textures from the secondary view. - Use these textures in custom render passes or shaders.
- Retrieve the
What I’ve Done So Far:
- SceneViewExtension:
- Implemented an
FSceneViewExtension
class to inject custom rendering logic. - Overridden necessary methods like
PrePostProcessPass_RenderThread
to access and manipulateSceneTextures
.
- Implemented an
- Custom Render Passes and Shaders:
- Set up custom render passes and global shaders that are working as intended.
- Able to manipulate the main view’s
SceneTextures
successfully.
The Challenge:
I’m stumped on how to properly render the secondary view from the different ViewOrigin
and access its SceneTextures
within the rendering pipeline. Specifically:
- Creating the Secondary View:
- How to set up and render a new
FSceneView
orFViewInfo
from the alternate location within the existing rendering flow. - Ensuring that rendering this view does not affect the main camera’s view.
What I’ve Tried:
- Attempted to Create a New View in
PrePostProcessPass_RenderThread
,SetupView
,SetupViewFamily
:- Created a new
FSceneViewFamily
andFViewInfo
for the secondary view. - Faced compilation errors and runtime issues, likely due to incorrect setup or misuse of the rendering API.
- Created a new
- Considered Rendering to a
UTextureRenderTarget2D
:- Thought about rendering the secondary view to a separate render target.
- Uncertain how to integrate this render target back into the render graph to access its
SceneTextures
.
Specific Questions:
- How can I correctly set up and render a secondary view from a different
ViewOrigin
within the rendering pipeline usingSceneViewExtension
? - Are there any examples or recommended practices for rendering additional views and accessing their textures without affecting the main view?
Additional Information:
- Engine Version: Unreal Engine 5.4.
- Constraints:
- I’m not using
USceneCaptureComponent2D
because I prefer to handle this within the rendering pipeline directly for performance and integration reasons. - I already have custom render passes and shaders working; I just need help with rendering the secondary view and accessing its textures.
- I’m not using
Any guidance, examples, or suggestions would be greatly appreciated!
Thank you for your time and assistance.