Hi
I wrote a render feature request three pass
the first two pass need render target to a RenderTexutre , and the third pass blit the RT back to main camera.
I need depth buffer for the RT (for z-test)
so what I used to do is request a temporary RT with code
cmd.GetTemporaryRT(mRT_ID,512,512, (int) DepthBits.Depth24);
with URP 13.1(Unity 2022.1.14f1) , unity give me a warning
[CS0618] 'ScriptableRenderPass.Blit(CommandBuffer, RenderTargetIdentifier, RenderTargetIdentifier, Material, int)' is obsolete:
'Use RTHandles for source and destination'
so I try to change my code with RTHandles
RTHandles.Initialize(512,512); //Init somewhere before a call Alloc
...
var mRT_Handler = RTHandles.Alloc(Vector2.one, depthBufferBits: DepthBits.Depth24);
the issue is, I can’t Sample the right info from the RT (alloc by RTHandles).
I check the RTHandleSystem.cs file. seem , if I request depth with Alloc function , the RT create by RTHandles will use RenderTextureFormat.Depth format
I use
TEXTURE2D(_MainTex);
SAMPLER(sampler_MainTex);
to sampler the RT info in the third pass . it worked for cmd.GetTemporaryRT. but not can’t get the right info with RTHandles.Alloc();
so . what should I to fix this issue?
thanks