Skip to content

Instantly share code, notes, and snippets.

@antoinefortin
Created May 22, 2021 04:59
Show Gist options
  • Select an option

  • Save antoinefortin/eafbce8f0430b61ba21096a0e474220d to your computer and use it in GitHub Desktop.

Select an option

Save antoinefortin/eafbce8f0430b61ba21096a0e474220d to your computer and use it in GitHub Desktop.
/* Use this to clear GBuffer like...*/
float3 GetNormalWorldSpace(float2 uv, float depth)
{
float3 normalWS = 0.0f;
if (depth > 0.0f)
{
NormalData normalData;
const float4 normalBuffer = LOAD_TEXTURE2D_X(_NormalBufferTexture, uv);
DecodeFromNormalBuffer(normalBuffer, uv, normalData);
normalWS = normalData.normalWS;
}
return normalWS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment