HI.
I used a translator. Please take into consideration
I want a get RenderTexture From Camera Depth Texture using Commandbuffer.Blit
in 2 ways.
public Material DepthMT;
public RenderTexture RT;
void onEnable()
{
var data = GetComponent<HDAdditionalCameraData>();
if (data != null) data.customRender += CustomRender;
CB = new CommandBuffer();
}
void onDisable()
{
var data = GetComponent<HDAdditionalCameraData>();
if (data != null) data.customRender -= CustomRender;
CB.Release();
}
void CustomRender(ScriptableRenderContext context, HDCamera camera)
{
if (camera == null || camera.camera == null)
return;
CB.Blit(BuiltinRenderTextureType.CurrentActive, RT, DepthMT);
camera.camera.AddCommandBuffer(CameraEvent.BeforeForwardOpaque, CB);
context.ExecuteCommandBuffer(CB);
}
public Camera _camera;
public Material DepthMT;
public RenderTexture RT;
void OnEnable()
{
CommandBuffer CB = new CommandBuffer();
CB.Blit(BuiltinRenderTextureType.CurrentActive, RT, DepthMT);
_camera.AddCommandBuffer(CameraEvent.AfterSkybox, CB);
}
Both methods were useless.
Without HDRP, it runs well using OnRenderImage()
With HDRP, itβs not working.
i make Depth Shader use shadergraph.
I uploaded the shader as an image file.
Please Tell me the problem. and show me the relevant documents.
Thanks.