- Home /
Problem with camera target texture and replacement shader
I'll explain my setup using this image:
C2 is my main camera which renders things normally, no scripts attached
C1 is the second camera, which has a replacement shader and outputs to custom target buffers so I can use them in the replacing shaders.
Q1 is a quad that shows the depth buffer from C1
Q2 is a quad that shows the color buffer from C1
Object A has it's shader replaced with a shader that only outputs (0, 1, 0, 1)
Object B (the sphere) has it's shader replaced with a shader that outputs (C1-depthBuffer, 0, 0, 1). As you can see in the "Camera Preview" screen.
Why doesn't the color buffer from Q2 (in the game view) looks the same as the Camera preview? And how can I make it look the same? The difference in the camera preview / game view that I'm talking about is that on the camera preview you can see the depth of object A, but in the game view, you can't.
Your answer
![](https://koobas.hobune.stream/wayback/20220612153231im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Shader works on Android but it is black on iOS 1 Answer
Help with multi-purpose replacement shader for camera 1 Answer
Shader Replacement not working with a very simple shader. 0 Answers
How to combine a camera rendering an edge detection image effect with another camera 1 Answer
Camera Depth Texture from a second camera with replacement shader 2 Answers