Hi, I updated my project from URP 12 to URP 13, and since then my render pass is followed automagically by a “Clear” color, which is the opposite of what I want.
If I’m writing inside the RenderTarget in the BeforeRenderingOpaques this for a good reason why this “Clear” appear from nowhere?
Also, if I call the BlitToStack pass on the AfterRenderingOpaques, no clear appear automagically between my pass and the next pass. Where this clear come from? And why urp assume we need a clear here? It was working perfectly on URP 12 without this clear.
private RTHandle _target;
private RTHandle _rtd;
void Dispose()
{
_rtd?.Release();
}
public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData)
{
_target = renderingData.cameraData.renderer.cameraColorTargetHandle;
var desc = renderingData.cameraData.cameraTargetDescriptor;
desc.depthBufferBits = 0; // Color and depth cannot be combined in RTHandles
RenderingUtils.ReAllocateIfNeeded(ref _rtd, desc, FilterMode.Point, TextureWrapMode.Clamp, name: "_MergeBufferHandle");
}
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
{
var cb = CommandBufferPool.Get("BlitToStack");
CreateCommandBuffer(cb);
context.ExecuteCommandBuffer(cb);
CommandBufferPool.Release(cb);
}
private void CreateCommandBuffer(CommandBuffer cb)
{
if (StackTexture.Count > 1)
{
for (var i = 0; i < StackTexture.Count; i++)
{
cb.SetGlobalTexture("_MainTex", StackTexture[i]);
cb.Blit(StackTexture[i], _rtd, Mat, 0);//, new Vector2(1f, -1f), new Vector2(0, 1f));
}
cb.Blit(_rtd, _target);
}
else
{
cb.Blit(StackTexture[0], _target);
}
}