浏览代码

Implement Emmanuel's energy compensation method

/Yibing-Project-2
Evgenii Golubev 7 年前
当前提交
76f9d00f
共有 2 个文件被更改,包括 17 次插入3 次删除
  1. 10
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl
  2. 10
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Resources/ComputeGgxEnergyCompensationFactors.shader

10
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl


}
specularLighting += F * DV;
#define MS_GGX 1
#define MS_GGX 1
#define MS_GGX_IMAGEWORKS 0
#if MS_GGX_IMAGEWORKS
#endif
#else
float ecV = SAMPLE_TEXTURE2D_LOD(_GgxEnergyCompensationFactors, s_linear_clamp_sampler, float2(NdotV, bsdfData.perceptualRoughness), 0).r;
specularLighting += F * DV * ecV;
#endif // MS_GGX_IMAGEWORKS
#endif // MS_GGX
#ifdef LIT_DIFFUSE_LAMBERT_BRDF
float diffuseTerm = Lambert();

10
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Resources/ComputeGgxEnergyCompensationFactors.shader


float3 V = float3(sqrt(1 - NdotV * NdotV), 0, NdotV);
float fDir = ComputeGgxEnergyCompensationFactor(V, N, roughness);
#define MS_GGX_IMAGEWORKS 0
#if MS_GGX_IMAGEWORKS
float fAvg = 0;
const uint numSamples = 128;

fAvg += ComputeGgxEnergyCompensationFactor(V, N, roughness) * NdotV * (2 * rcp(numSamples));
}
// f_ms = f[NdotV, perceptualRoughness] * f[NdotL, perceptualRoughness].
#else
// f_ms = f[NdotV, perceptualRoughness] * f_ss.
float f = 1 / fDir - 1;
#endif
// f_ms = f[NdotV, perceptualRoughness] * f[NdotL, perceptualRoughness].
return f.xxxx;
}

正在加载...
取消
保存