浏览代码

Factor out ComputeWrappedDiffuseLighting()

/RenderPassXR_Sandbox
Evgenii Golubev 8 年前
当前提交
6a7757cc
共有 2 个文件被更改,包括 9 次插入4 次删除
  1. 7
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl
  2. 6
      Assets/ScriptableRenderPipeline/ShaderLibrary/CommonMaterial.hlsl

7
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl


{
// Reverse the normal + do some wrap lighting to have a nicer transition between regular lighting and transmittance
// Ref: Steve McAuley - Energy-Conserving Wrapped Diffuse
illuminance = saturate((-NdotL + SSS_WRAP_LIGHT) / ((1 + SSS_WRAP_LIGHT) * (1 + SSS_WRAP_LIGHT)));
illuminance = ComputeWrappedDiffuseLighting(NdotL, SSS_WRAP_LIGHT);
// For low thickness, we can reuse the shadowing status for the back of the object.
shadow = bsdfData.useThinObjectMode ? shadow : 1;

{
// Reverse the normal + do some wrap lighting to have a nicer transition between regular lighting and transmittance
// Ref: Steve McAuley - Energy-Conserving Wrapped Diffuse
illuminance = saturate((-NdotL + SSS_WRAP_LIGHT) / ((1 + SSS_WRAP_LIGHT) * (1 + SSS_WRAP_LIGHT)));
illuminance = ComputeWrappedDiffuseLighting(NdotL, SSS_WRAP_LIGHT) * attenuation;
// For low thickness, we can reuse the shadowing status for the back of the object.
shadow = bsdfData.useThinObjectMode ? shadow : 1;

[branch] if (bsdfData.enableTransmission)
{
// Reverse the normal + do some wrap lighting to have a nicer transition between regular lighting and transmittance
// Ref: Steve McAuley - Energy-Conserving Wrapped Diffuse
illuminance = saturate((-NdotL + SSS_WRAP_LIGHT) / ((1 + SSS_WRAP_LIGHT) * (1 + SSS_WRAP_LIGHT)));
illuminance = ComputeWrappedDiffuseLighting(NdotL, SSS_WRAP_LIGHT) * clipFactor;
// For low thickness, we can reuse the shadowing status for the back of the object.
shadow = bsdfData.useThinObjectMode ? shadow : 1;

6
Assets/ScriptableRenderPipeline/ShaderLibrary/CommonMaterial.hlsl


return 0.25 * (expOneThird + 3 * expOneThird * expOneThird * expOneThird) * volumeAlbedo;
}
// Ref: Steve McAuley - Energy-Conserving Wrapped Diffuse
float ComputeWrappedDiffuseLighting(float NdotL, float w)
{
return saturate((-NdotL + w) / ((1 + w) * (1 + w)));
}
// MACRO from Legacy Untiy
// Transforms 2D UV by scale/bias property
#define TRANSFORM_TEX(tex, name) ((tex.xy) * name##_ST.xy + name##_ST.zw)

正在加载...
取消
保存