- Home /
Using clear flags in forward camera in 2d renderer project
In my setup(Unity 2019.3.1f1) I have a 2d renderer camera for the complete game, and a forward renderer camera for the 2.5D water. If you look at the documentation for the Camera class, you see the option to choose the clear flags. https://docs.unity3d.com/Manual/class-Camera.html I want to setup the clear flags so the water renderer, renders on top of the 2d renderer. However, the option as shown in the documentation is missing from my camera settings. Is there any way I can still use clear flags and render the water on top of the 2d sprites?
Answer by Cambesa · Jul 24, 2020 at 03:33 PM
Update: Upgrading UniversalRP package to 7.2.1 opens up the ability to use stacking cameras, an even newer version and updated unity is required for stacking to work for 2d renderers. After updating both, you can set the camera type to overlay and add it to the camera stack of the main camera. However combining a 2d renderer as main camera and a forward renderer as secondary camera does not seem to work. The shader of the water does not suport the 2d renderer but it does support the forward renderer. If you isolate the forward renderer and only look at that one, the water works. The test object i've put in the water layer also works. But when used in stacking mode, the test object does work but the water fails to render, even when clearing the depth on the overlay camera. Is there any link between the 2d renderer camera and it's overlay camera which allows only 2d renderer shaders to work?