Wednesday, October 4, 2023
HomeSample Page

Sample Page Title

Using Unity’s URP I’ve been making an attempt to setup a scriptable render characteristic which can add a go which attracts objects on a sure layer to a number of render targets. Unfortunately, I’m not capable of get it to attract to the digital camera’s depth buffer it doesn’t matter what I do. According to the docs there’s a technique to specify a depth attachment together with coloration attachments. Looking on the supply code, it appears that evidently Unity will default to utilizing BuiltinRenderTextureType.CameraTarget if no depth attachment is specified. Unfortunately, I feel the precise utilization is closed supply so I do not know the way Unity handles it.

One factor I observed is that it appears it should solely draw to the right depth buffer if I set the render goal to cameraColorTarget:

var rt = new RenderTargetIdentifier(renderingData.cameraData.renderer.cameraColorTarget, 0, CubemapFace.Unknown, -1);

ConfigureTarget(rt, m_CameraDepthTarget);
// Or additionally works:

and setting it to anything would not work. I’m drawing within the Exceute methodology utilizing context.DrawRenderers.

What I’m questioning is that if there’s a way I can draw coloration to a special render goal than digital camera’s framebuffer, however nonetheless draw/check depth utilizing default depth buffer? Without a lot sources and documentation on URP facet of issues I’m a bit misplaced on if/how it may be accomplished on the level. Is it one thing that may be accomplished normally? Or are depth buffers someway tied to a render texture underneath the hood or one thing so it’s not potential? But if that’s the case, then it ought to nonetheless be potential utilizing a number of render targets (MRT) since I can render to cameraColorTarget in addition to my customized render goal in a single go (however sadly I’ve tried and would not appear to work for no matter motive).



Please enter your comment!
Please enter your name here

Most Popular

Recent Comments