I read for some people it worked setting Background type to “Uninitialized” but it does nothing for me. I’m using Unity 2020.1.15f1
Afaik they removed the “Don’t clear” flag, as it is not supported as is in the new render pipelines. “Uninitialized” stops the color buffer, but not the depth buffer. (“Don’t Clear” does not clear either)
“Uninitialized” should still give you some sort of “color smearing”, though. Maybe check if how your camera stack is set up, maybe there is happening some extra discarding.
Other than that, if you want to have it behave as in built-in, I’d argue you have to write your own render pipeline or adjust the URP. Depending on what you want to use it for, there might be different solution for achieving the effects you want to create (and maybe cheaper).
I wanted to have a second camera (with don’t clear or something equivalent) to make a render texture saving the movement path of a sprite so I can “paint it” on the ground (using the texture on a custom shader). I think it would be enough with the color buffer but I’m not even getting any color smearing. This is my camera setting rn:
I’m adjusting the size to the ground’s mesh via script and also getting the render texture there. I’ve never used the camera stack but I think it’s not necessary here since I only want the render texture, not stacking both cameras to use them as an output but correct me if I’m wrong.
Okay, so I got a wrong assumption about what “Background Type” meant, it actually just does what it says: what type of background is rendered. Where “uninitialized” just doesn’t render any background at all. (it was confusing, as they used the same wording in the doc) Even in the debug view, there is still a “Clear Flag” option, that doesn’t behave as it has been. So it probably has to do with how they have changed rendering in URP/HDRP. With that I would say: “Don’t clear” flag is not supported by default in URP/HDRP.
I haven’t really worked enough with RP scripting to give a helpful answer on how to “bring that feature back”. But I still might help with what you actually want to achieve.
Your description of what you want to do, reads a bit as if you want to do something similar like snow displacement on the ground, where particles are often used to create data on a RT which then drives something in another material. Here is a tutorial on how to achieve this in unity: https://www.youtube.com/watch?v=ftCyZ7F5q9E
You could then just change the particle sprite, to the sprite you want to actually “paint” on the ground.
If I misunderstood, then here are alternative solutions for “painting”:
- make custom post process shader + script, that acts similar as the don’t clear (writing the last captured frame of the camera, add the new capture and repeat for every frame)
- Use a trail renderer as “Brush” and capture it via RT with a second camera.
Edit: Remembered this tutorial by “Mix and Jam” recreating the brush from Okami: https://www.youtube.com/watch?v=yuQXeaYBuuM
Ah okay, that explains why setting it to uninitialized wasn’t working.
I was working already on the trail renderer approach but after watching Mix and Jam’s video I might try to do it that way. Thank you!