- Home /
Graphics.blit 3 texture
Hi guys
I am very puzzled.
Set up this code in an empty scene. and set up the scene similar to the screen shot. so 3 camera each can only see 1 object. and each camera will render what it sees to a rawImage. the expect result is raw image 1 sees the cube, raw imge 2 sees the cube and the sphere and raw image 3 sees cube sphere and capsule. but image 3 is where it gets weird. it sees cube and capsule instead.
[SerializeField] Camera CameraA;
[SerializeField] Camera CameraB;
[SerializeField] Camera CameraC;
[SerializeField] RenderTexture textureA;
[SerializeField] RenderTexture textureB;
[SerializeField] RenderTexture textureC;
[SerializeField] RawImage rawImageA;
[SerializeField] RawImage rawImageB;
[SerializeField] RawImage rawImageC;
private void Start()
{
textureA = new RenderTexture(CameraA.pixelWidth, CameraA.pixelWidth, 1);
textureB = new RenderTexture(CameraB.pixelWidth, CameraB.pixelWidth, 2);
textureC = new RenderTexture(CameraC.pixelWidth, CameraC.pixelWidth, 3);
CameraA.targetTexture = textureA;
CameraB.targetTexture = textureB;
CameraC.targetTexture = textureC;
rawImageA.texture = textureA;
rawImageB.texture = textureB;
rawImageC.texture = textureC;
}
// Update is called once per frame
void Update()
{
Graphics.Blit(textureA, textureB);
Graphics.Blit(textureB, textureC);
}
Answer by Bunny83 · Apr 30, 2020 at 10:34 AM
We have no idea what the clear flags of your 3 cameras look like. Since you have a solid background we can assume that at least one camera is clearing the background with a solid color. We also don't know how large the area of the 3 cameras are and if they render to the full screen / rendertexture or only a part of it. Graphics.Blit will copy the entire content of the first texture ontop of the second texture.
It's also not clear if you used a layer mask for any of your cameras / objects. Though what is the most disurbing is that you use a 1 bit depth buffer for the first rendertexture, a 2 bit depth buffer for the second and a 3 bit depth buffer for the 3rd. Note that only depth buffers values of 0, 16 or 24 are actually supported.
I thought the depth is like an order. ok let me try. but what would be the correct settings needed to get the images to show up as expected. The background is actually an image. all three camera are depth only clear flag.
Your answer
![](https://koobas.hobune.stream/wayback/20220612232846im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Using Graphics.Blit with the same source and destination 1 Answer
use RenderTexture on a sphere correctly? 1 Answer
dynamic hole in layer / texture / camera 0 Answers
OnRenderImage not getting called 2 Answers
How Blit internally works? 2 Answers