浏览代码

Clean up and optimize a bit

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

9
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));
[branch]
if (h == 0) { return 0; } // Perform horizon clipping
[unroll]
for (int i = 0; i < 4; i++)
{

float y = cosOmega;
float b = (x + x * y) * 0.5; // Bilinear approximation
float z = b * sqrt(x); // Area light approximation
float c = z * z; // Perform horizon clipping
float h = saturate(saturate(L[0].z) + saturate(L[1].z) + saturate(L[2].z) + saturate(L[3].z));
return lerp(z, c, 1 - h);
return lerp(z * z, z, h); // Horizon fade
#endif
#else
// 1. ClipQuadToHorizon

正在加载...
取消
保存