浏览代码

Optimize the isotropic GGX BSDF (-8 cycles on GCN)

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

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


out float3 diffuseLighting,
out float3 specularLighting)
{
float3 H = normalize(V + L);
float LdotH = saturate(dot(L, H));
float NdotH = saturate(dot(bsdfData.normalWS, H));
float NdotL = saturate(dot(bsdfData.normalWS, L));
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 NdotH = saturate((NdotL + NdotV) * invLenLV);
float LdotH = saturate(invLenLV + invLenLV * LdotV);
float3 F = F_Schlick(bsdfData.fresnel0, LdotH);
float Vis;

if (bsdfData.materialId == MATERIALID_LIT_ANISO)
{
float3 H = normalize(V + L);
// For anisotropy we must not saturate these values
float TdotH = dot(bsdfData.tangentWS, H);
float TdotL = dot(bsdfData.tangentWS, L);

正在加载...
取消
保存