I have a Unity URP project and in the Scriptable Render Pipeline, I would like to create a RenderTexture
and pass the depth and color buffer of the camera object as the color and depth buffer of this RenderTexture
object. Unfortunately, these buffers only have a getter, so I suppose only copy / blit operations would solve my problem. However I don't wanna copy, just pass the references. Is there a way I can achieve this?
I want to process the depth and color buffer of the camera in one shader call, but now I need to do it in two steps.
In the shader, I would process both of them like this:
float4 frag(v2f i, out float depth : SV_Depth) : SV_Target
{
float scale = 2.0;
float3 color = Rcas(i.uv, scale);
depth = SAMPLE_DEPTH_TEXTURE(_MainTex, i.uv);
return float4(color, 1.0);
}
Any ideas are appreciated!