浏览代码

Including TIR in iridescence F reflectance, useful when using dual normal maps (only for stacklit).

/main
Stephane Laroche 7 年前
当前提交
82cd91dd
共有 2 个文件被更改,包括 5 次插入2 次删除
  1. 5
      com.unity.render-pipelines.core/CoreRP/ShaderLibrary/BSDF.hlsl
  2. 2
      com.unity.render-pipelines.high-definition/HDRP/Material/StackLit/StackLit.hlsl

5
com.unity.render-pipelines.core/CoreRP/ShaderLibrary/BSDF.hlsl


// real eta_2 = lerp(eta_1, eta_2, smoothstep(0.0, 0.03, Dinc));
// Evaluate the cosTheta on the base layer (Snell law)
real sinTheta2 = Sq(eta_1 / eta_2) * (1.0 - Sq(cosTheta1));
//debug: TIR if( sinTheta2 > 1.0 ) return real3(1.0, 0.0, 0.0);
#ifdef UNITY_MATERIAL_STACKLIT
//TIR
if( sinTheta2 > 1.0 ) return real3(1.0, 1.0, 1.0);
#endif
real cosTheta2 = sqrt(1.0 - sinTheta2);
// First interface

2
com.unity.render-pipelines.high-definition/HDRP/Material/StackLit/StackLit.hlsl


if (bsdfData.iridescenceMask > 0.0)
{
preLightData.fresnelIridforCalculatingFGD = EvalIridescence(topIor, NdotV[0], bsdfData.iridescenceThickness, bsdfData.fresnel0);
f0forCalculatingFGD = lerp(bsdfData.fresnel0, preLightData.fresnelIridforCalculatingFGD, bsdfData.iridescenceMask);
f0forCalculatingFGD = lerp(f0forCalculatingFGD, preLightData.fresnelIridforCalculatingFGD, bsdfData.iridescenceMask);
}
}

正在加载...
取消
保存