No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ProbeVolumeSamplingDebugPositionNormal.compute 1.1KB

1234567891011121314151617181920212223242526
  1. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/EntityLighting.hlsl"
  2. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
  3. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  4. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl"
  5. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl"
  6. // Compute worldspace position and normal at given screenspace position and write it in the ResultBuffer
  7. #pragma kernel ComputePositionNormal
  8. RWStructuredBuffer<float4> _ResultBuffer;
  9. uniform float4 _positionSS; // screenspace position
  10. [numthreads(1,1,1)]
  11. void ComputePositionNormal (uint3 id : SV_DispatchThreadID)
  12. {
  13. float deviceDepth = LOAD_TEXTURE2D_X(_CameraDepthTexture, _positionSS.xy).r;
  14. float2 positionNDC = _positionSS.xy *_ScreenSize.zw + (0.5 * _ScreenSize.zw);
  15. float3 positionWS = ComputeWorldSpacePosition(positionNDC, deviceDepth, UNITY_MATRIX_I_VP);
  16. float3 normalWS = LoadSceneNormals(_positionSS.xy);
  17. _ResultBuffer[0] = float4(positionWS, 1.0f);
  18. _ResultBuffer[1] = float4(normalWS, 0.0f);
  19. }