Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How do I copy depth to the camera target in Unity' (Read 100 times)
New Member

I Love YaBB 2.6.11!

Posts: 1
Joined: Jul 19th, 2019
How do I copy depth to the camera target in Unity'
Jul 19th, 2019 at 3:10pm
Print Post  
Hello, I'm trying to copy the depth buffer to camera target after post-processing in my render pipeline, but instead it's just black. Thus, the gizmos (that I draw through UnityEditor.Handles.DrawGizmos btw) aren't affected by depth unless I disable post-processing. I render the depth buffer to a different texture for shaders to use, but that's about it. Also there's an odd thing is that when I draw depth of field (which is in second pass btw) the buffer does get copied to that texture according to frame debugger, but when I don't render it it does the same to a different effect. I'm using Unity 2019.1.9f1, by the way. Maybe it was fixed in future releases, but I'm not updating with my current internet, no thanks.

Things I've already tried:
Rendering depth into BuiltinRenderTextureType.Depth. It does nothing and instead sends a warning in console about target type 3 not existing.
Not using CommandBuffer.Blit and doing it manually (render a fullscreen quad with a material). Same thing minus the second pass mystery.
Copying depth with a pass in the end. No depth buffer at all.
Setting a render target to a destination texture's color buffer and source's depth buffer. As expected, nothing, even though others (including the official documentation) say it works. Might be just a misunderstanding, English isn't my mother tongue.
Same as 4, but instead setting a render target's depth to a camera target. Result is the same.
Copying depth in every pass. Same as blitting it, including the second pass mystery.
Could someone help me, please? I feel like I'm going crazy because of this.

P.S.: No, I don't want to use LWRP/HDRP, I don't know how to write custom renderers for the former so I can have toon shaders and I don't know how to access lights in a shader graph so I calculate lighting myself, this is why I decided to make my own RP. If someone tells me how to do that, it would also be very nice and I might move to LWRP.

P.P.S.: I didn't find any tutorials for post-processing with SRP online and my current system is based on researching LWRP.


hire the best press release writing service
Back to top
IP Logged
Page Index Toggle Pages: 1
Send TopicPrint