浏览代码

Factor out common code

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

7
Assets/ScriptableRenderPipeline/ShaderLibrary/AreaLighting.hlsl


// N.b.: this function accounts for horizon clipping.
float DiffuseSphereLightIrradiance(float sinSqSigma, float cosOmega)
{
float irradiance;
float sinSqOmega = saturate(1 - cosOmega * cosOmega);
#if 0 // Ref: Area Light Sources for Real-Time Graphics, page 4 (1996).
float cosSqSigma = saturate(1 - sinSqSigma);

// }
float e = sinSqSigma * cosOmega;
float irradiance;
[branch]
if (omega < HALF_PI - sigma)

}
}
#else // Ref: Moving Frostbite to Physically Based Rendering, page 47 (2015).
float irradiance;
[branch]
if (cosOmega * cosOmega > sinSqSigma)
{

float x = sqrt(a);
float y = -x * cosOmega * rsqrt(sinSqOmega);
float z = sqrt(sinSqOmega * (1 - y * y));
irradiance = INV_PI * ((cosOmega * acos(y) - x * z) * sinSqSigma + atan(z * w));
}
#endif

正在加载...
取消
保存