InvalidOperationException: Trying to use a texture (_CameraNormalsTexture) that was already released or not yet created. Make sure you declare it for reading in your pass or you don't read it before it's been written to at least once
and breaks the renderer.
This is not written in the docs, do not sure if this a bug or a documentation error.
Can you try? m_ScriptablePass.ConfigureInput(ScriptableRenderPassInput.Normal | ScriptableRenderPassInput.Depth);
ConfigureInput API should only be called once with all the required inputs, by calling it twice you are overriding your initial choice and losing it.
First case:
m_ScriptablePass.ConfigureInput(ScriptableRenderPassInput.Depth); // required input is depth
m_ScriptablePass.ConfigureInput(ScriptableRenderPassInput.Normal); // required input is now normal only
Second case:
m_ScriptablePass.ConfigureInput(ScriptableRenderPassInput.Depth); // required input is normal
m_ScriptablePass.ConfigureInput(ScriptableRenderPassInput.Normal); // required input is now depth only
.... // your render feature uses the normal texture but URP is not aware that it is a required input for your pass and therefore the resource is not ready, triggering an error at RenderGraph level.
which makes sense with what you said. I have access to the depth texture only if i call it last.
In the end I don’t use the camera normal texture anymore, I do a custom pass, compute the view space normals for a certain render list and use this render attachment in my fullscreen pass. so I’m only configuring for depth.
But i’m curious as to what would be the right way to access both camera depth and camera normal texture in one single render feature. Do you have an idea?
This ^ is supposed to be the correct way to require both normal and depth inputs for your pass. We currently use this exact same workflow in URP for SSAO pass (link) and DBuffers (link), and it seems to be working.
How can you tell you don’t have access to the depth texture anymore? Something else might be wrong.
Ok, not sure what happens but when accessing resourceData.cameraDepthTexture in my pass depending on if i’m using m_ScriptablePass.ConfigureInput(ScriptableRenderPassInput.Depth);
or m_ScriptablePass.ConfigureInput(ScriptableRenderPassInput.Normal | ScriptableRenderPassInput.Depth);
I have two different cameraDepthTexture. First one with just red channel is first configure, second in grayscale is second configure.