浏览代码

Optimize the computation of the half vector

/fptl_cleanup
Evgenii Golubev 8 年前
当前提交
f9ef74c7
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 4
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl

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


float NdotL = saturate(dot(bsdfData.normalWS, L));
float NdotV = preLightData.NdotV;
float LdotV = dot(L, V);
float invLenLV = rsqrt(2 + 2 * LdotV); // rcp(length(L + V))
float invLenLV = rsqrt(abs(2 + 2 * LdotV)); // invLenLV = rcp(length(L + V))
float NdotH = saturate((NdotL + NdotV) * invLenLV);
float LdotH = saturate(invLenLV + invLenLV * LdotV);

// Maybe always using aniso maybe a win ?
if (bsdfData.materialId == MATERIALID_LIT_ANISO)
{
float3 H = normalize(V + L);
float3 H = (L + V) * invLenLV;
// For anisotropy we must not saturate these values
float TdotH = dot(bsdfData.tangentWS, H);
float TdotL = dot(bsdfData.tangentWS, L);

正在加载...
取消
保存