浏览代码

Add sampling helpers

/RenderPassXR_Sandbox
Evgenii Golubev 7 年前
当前提交
98c12207
共有 2 个文件被更改,包括 22 次插入1 次删除
  1. 2
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Resources/CombineSubsurfaceScattering.shader
  2. 21
      Assets/ScriptableRenderPipeline/ShaderLibrary/Fibonacci.hlsl

2
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Resources/CombineSubsurfaceScattering.shader


{ \
float r = kernel[profileID][i][0]; \
/* The relative sample position is known at compile time. */ \
float phi = TWO_PI * Fibonacci2d(i, n).y; \
float phi = SampleDiskFibonacci(i, n).y; \
float2 vec = r * float2(cos(phi), sin(phi)); \
\
/* Compute the screen-space position and the associated irradiance. */ \

21
Assets/ScriptableRenderPipeline/ShaderLibrary/Fibonacci.hlsl


}
}
// Returns the radius as the X coordinate, and the angle as the Y coordinate.
float2 SampleDiskFibonacci(uint i, uint sampleCount)
{
float2 f = Fibonacci2d(i, sampleCount);
return float2(f.x, TWO_PI * f.y);
}
// Returns the zenith as the X coordinate, and the azimuthal angle as the Y coordinate.
float2 SampleHemisphereFibonacci(uint i, uint sampleCount)
{
float2 f = Fibonacci2d(i, sampleCount);
return float2(1 - f.x, TWO_PI * f.y);
}
// Returns the zenith as the X coordinate, and the azimuthal angle as the Y coordinate.
float2 SampleSphereFibonacci(uint i, uint sampleCount)
{
float2 f = Fibonacci2d(i, sampleCount);
return float2(1 - 2 * f.x, TWO_PI * f.y);
}
#endif // UNITY_FIBONACCI_INCLUDED
正在加载...
取消
保存