浏览代码

Make sure there is no energy loss when the light is entirely above the horizon

/Branch_Batching2
Evgenii Golubev 8 年前
当前提交
091d4389
共有 1 个文件被更改,包括 6 次插入4 次删除
  1. 10
      Assets/ScriptableRenderPipeline/ShaderLibrary/AreaLighting.hlsl

10
Assets/ScriptableRenderPipeline/ShaderLibrary/AreaLighting.hlsl


float PolygonIrradiance(float4x3 L)
{
#ifdef SPHERE_LIGHT_APPROXIMATION
float h = saturate(saturate(L[0].z) + saturate(L[1].z) + saturate(L[2].z) + saturate(L[3].z));
float h = saturate(L[0].z) + saturate(L[1].z) + saturate(L[2].z) + saturate(L[3].z);
[branch]
if (h == 0) { return 0; } // Perform horizon clipping

#else
float x = sinSqSigma;
float y = cosOmega;
float b = (x + x * y) * 0.5; // Bilinear approximation of a sphere light
float z = b * sqrt(x); // Our approximation of a rectangular light
float b = x * (0.5 + 0.5 * y); // Bilinear approximation of a sphere light
float z = b * sqrt(x); // Our approximation of a rectangular light
float a = f2 * b * b; // (x * b)^2
float r = x * y; // The reference value for an unoccluded light
return lerp(z * z, z, h); // Horizon fade
return max(r, lerp(a, z, saturate(h))); // Horizon fade
#endif
#else
// 1. ClipQuadToHorizon

正在加载...
取消
保存