- Home /
Objects are drawn behind others
Greetings,
I use a second camera to draw certain objects on top of others such as guns and bullet marks to prevent them from going through the wall and to prevent z-fighting issues. It works well and does what it is intended to do, but I have one problem.
Because the bullet marks are drawn on top of all other objects, these bullet marks will always be visible, even when behind other objects. This is of course not something I would want.
So how do I stop these bullet marks from "rendering-through" other objects?
Thanks!
@Aldonaletto The bullet marks a drawn with a second camera. The second camera only draws the bullet marks and the gun(s) while the primary camera draws everything else besides the bullet marks and the gun(s). The bullet marks use the shader "Transparent/Diffuse".
Answer by farooqaaa · Mar 25, 2012 at 04:43 PM
Select the second camera in the Editor and set its depth higher than the main camera.
Also, check the layers.
It already is. The main camera has a depth of 0 while the second camera(the one that draws the bullet marks) has a depth of 1.
What about the layers? Are you sure you have set up the culling for the cameras correctly?
Your answer