I’m a bit stuck trying to replicate a camera stacking setup that worked fine with the built-in renderer. This is a 2D project; I have two cameras, one that captures just the background, and one that captures everything else (player, sprites, UI). I used to be able to configure the Background Camera as Depth 0 and the Main Camera as Depth 1, then set the Main Camera’s “Clear Flags” property to Depth Only. This let me apply post processing effects to the background layer, separate from the rest of the sprites, UI, etc.
Now, even though URP has camera stacking, it seems to work a bit different. First, it only has Base or Overlay options. Given that I just want “background” and “everything else” cameras, calling the “everything else” a.k.a my main game camera, the “overlay” camera just because it’s what should be stacked on top of the background - feels very awkward. But that’s a minor issue; the big problem I have is that apparently, the Pixel Perfect Camera doesn’t support camera stacking!
I need both a way to stack cameras and for the pixel perfect camera script to work. Do I have any options in URP or do I have to switch back to built-in???
Edit: Thinking maybe I just render the two stacked cameras to a render texture and then add a third camera to render that with the pixel perfect script applied there, but that feels pretty hacky.
I’m using two cameras to isolate full-screen shader effects applied only to the background layer vs everything else in the game. Why else would Unity offer culling masks, camera depth/priority, or camera stacking if they didn’t anticipate people wanting to composite a screen using multiple cameras, and how exactly would I apply separate post-processing renderer features to different layers with only a single camera?
Not meaning to be terse with you, I’m just frustrated with URP because it seems like everything that used to be fairly straightforward with the built-in renderer is now needlessly more complex, or not supported; this is at least the third or fourth hurdle I’ve ran into trying to convert a project from built-in to URP.
Edit: I tried my three camera solution but the pixel perfect script didn’t work properly unless I applied it to the overlay camera. It still displayed a warning, but it did seem to work. Unfortunately, for the next step of what I wanted to do, I tried to use two different renderers on the base and overlay cameras, but that made Unity bug out. So it doesn’t even seem like I can apply different renderers (with their own separate renderer features) as I had planned. I think I’ll just switch back to built-in renderer at this point…
I’m creating a few custom renderer features, something along the lines of this example. Some more specific examples would be a pixelation effect and a background warping effect.
The background is made up of multiple images, each with their own movement and animations, stacked on top of each other. I thought capturing that entire scene each frame with a camera would be easiest, so I could then apply custom render passes to the background as a whole. Also, I need to only target the background, since I don’t want these effects applied to anything else I draw on top.