- Home /
Help I cant use multiple cameras with layers. [Solved]
Hello
I have not tried post processing before so i have no idea what im doing. I Have two cameras, one sees everything expect the gun and one sees only the gun. However when I press play there is only one camera active. Like the different cameras cant form a single picture. I made a short film because its difficult to explain something i dont understand. Heres the link. https://ufile.io/lho8w
I just wondered what settings I should use.
Thanks if someone cares
Answer by Cornelius12 · Mar 31, 2019 at 01:59 PM
So I screwed around with the settings and apperantly found a solution. I set the deapth off both cameras to 1. And the camera that only sees the gun i set to Deapth only. I did some other stuff too but i dont know if that made any difference.
Setting both cameras to depth 1 makes no sense since now it's arbitrary which camera is rendered first. So you should define the correct rendering order by giving the first camera (main camera) a lower depth value than the second one.
Of course the second camera must not clear the screen (color buffer), otherwise everything that the first camera has already rendered will be cleared again. And yes, since the main point of rendering the gun seperately in FPS games is to avoid z buffer clipping of the gun when you're close to a wall, you want to clear the depth buffer for the second camera.
If you set the second camera to "don't clear" there would be no point in using a second camera and the effect would be like just using a single camera for everything.
@Bunny83 Ok so I changed the main camera to 1 and the secondary weapon camera to 2. What kind of difference does it make?
It's a rendering order thing. If they're on the same layer its last enabled that takes priority. But flickering and other things can happen when rendering on the same layer. It's just not correct to do so. Camera depth is specifically for rendering order of cameras. The clear flags means when the camera will clear the existing frame to draw a new one, if you are set to "don't clear" then your camera will never clear the old frames data, meaning you're stacking your visuals over and over. If you had moving objects or the camera moved, you would see permanent trails of the movement being left in the camera render frame. Clearing depth only means that it will clear any rendered frames based on the frustrum depth. ($$anonymous$$ight be wrong on the last part, I'm sure bunny will correct me if I am).