- Home /
render to framebuffer twice - how?
what i'd like to do:
render the camera using a certain culling mask to the framebuffer (or to whatever target unity decides to render to, maybe it's a render texture since some post effects are applied to this camera)
set clear flags of this camera to None and change the culling mask of the camera
render the camera to the same target a second time (using renderWithShader, but that's not important for the problem)
What I don't know is where/how to issue the camera.render() command in order to render the camera a second time. I cannot use the OnPostRender() function, as this would end up in an infinite recursion.
the reason I want to do this is that I want to use shaderReplacement on certain objects of my scene but not on all of them.
boiled down:
how can I render the camera a second time to the same render target within one frame and change some camera settings in between?
Can't you just manage a temporary disabled camera that you use to render your objects during OnPostRender?
Your answer
![](https://koobas.hobune.stream/wayback/20220613103140im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Best way to access RenderTexture immediately after camera render 0 Answers
OnpostRender is not called 4 Answers
Capture a Screenshot Through a Camera in the Lightweight Render Pipeline 1 Answer
Canvas Rendering Execution Order Question 0 Answers
How to make camera position relative to a specific target. 1 Answer