浏览代码

Fix the sample index

/Yibing-Project-2
Evgenii Golubev 7 年前
当前提交
56171b1b
共有 2 个文件被更改,包括 15 次插入5 次删除
  1. 4
      ScriptableRenderPipeline/Core/ShaderLibrary/ImageBasedLighting.hlsl
  2. 16
      ScriptableRenderPipeline/HDRenderPipeline/Sky/ComputeGgxIblSampleData.compute

4
ScriptableRenderPipeline/Core/ShaderLibrary/ImageBasedLighting.hlsl


// X = Sum(Radiance(L) * Weight) / Sum(Weight) = Sum(Radiance(L) * F * G) / Sum(F * G).
#ifndef USE_KARIS_APPROXIMATION
float F0 = 1; // The choice of the Fresnel factor does not appear to affect the result
float F = F_Schlick(F0, LdotH);
// The choice of the Fresnel factor does not appear to affect the result.
float F = 1; // F_Schlick(F0, LdotH);
float V = V_SmithJointGGX(NdotL, NdotV, roughness, preLambdaV);
float G2 = V * NdotL * NdotV; // 4 cancels out
lightInt += F * G2 * val;

16
ScriptableRenderPipeline/HDRenderPipeline/Sky/ComputeGgxIblSampleData.compute


while (true)
{
int wastedSampleCount = 0;
int acceptedSampleCount = 0;
int shiftedSampleIndex = 0;
for (int i = 0; i < sampleCount; i++)
{

SampleVisibleAnisoGGXDir(u, V, k_identity3x3, roughness, roughness, localL, NdotL, NdotH, LdotH, true);
if (NdotL <= 0) wastedSampleCount++;
if (NdotL > 0)
{
if (acceptedSampleCount == sampleIndex) shiftedSampleIndex = i;
acceptedSampleCount++;
}
if (validSampleCount == sampleCount - wastedSampleCount) break;
if (acceptedSampleCount == validSampleCount)
{
sampleIndex = shiftedSampleIndex;
break;
}
sampleCount++;
}

正在加载...
取消
保存