- Home /
Shader based camera compositing.
I have 2 cameras, one at depth 0 (camA) and one at depth -1 (camB).
I want to render camB then render camA, but cut a piece out of camA's result using the a material in camA's view to, allowing camB to show through. The reason for this is that rendering a camera to a texture looks crummy up close, and I read a while back that this would be a simple solution. Alas I cannot find the post which explained this. If you are a bit of an expert in the shader department and have a more efficient way to do this feel free to give your input as well.
Note: Don't say Camera.RenderToTexture, or Camera.RenderToCubemap, if those worked I wouldn't have posted this.
Cubemap:To slow
Texture: Low Res
Out of curiosity, what did you set the resolution of the RenderTexture to when you tried that?
Tried up to 2048, unfortunately I intend to walk through the object, so it always becomes pixalated as I approach the geometry.
Answer by Radon · Aug 03, 2012 at 03:30 AM
The best way to avoid confusion between camera views is using layers and culling mask.
Answer by ScroodgeM · Aug 03, 2012 at 07:43 AM
you should
set to camA 'depth only' clear flags
don't draw anything in places where you want to see camB's image
All right, but is there a way I can force a material to draw through to the background, of camA?
camB draws first, so it's not "draw through camA", it's a "don't draw by camA" where you want to see camB's image. so just disable geometry/make it transparent and you'll see camB's image in that place