Skip to content

Instantly share code, notes, and snippets.

@ShiftedClock
Created December 21, 2021 23:14
Show Gist options
  • Select an option

  • Save ShiftedClock/4eafed152bfda59a2ccb6f1c120a5682 to your computer and use it in GitHub Desktop.

Select an option

Save ShiftedClock/4eafed152bfda59a2ccb6f1c120a5682 to your computer and use it in GitHub Desktop.
Shader "FullScreen/CopyColorAndDepth"
{
HLSLINCLUDE
#pragma vertex Vert
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassCommon.hlsl"
TEXTURE2D_X(rayMarchColorOutput);
TEXTURE2D_X(rayMarchDepthOutput);
float4 FullScreenPass(Varyings varyings, out float depth : SV_Depth) : SV_Target
{
const uint3 id = uint3(varyings.positionCS.xy,0);
depth = rayMarchDepthOutput[id];
return rayMarchColorOutput[id];
}
ENDHLSL
SubShader
{
Pass
{
Name "CopyColorAndDepth"
ZWrite On
ZTest Always
Blend Off
Cull Off
HLSLPROGRAM
#pragma fragment FullScreenPass
ENDHLSL
}
}
Fallback Off
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment