浏览代码

HDRenderLoop: Submit optimization from Rune on area lights

/main
sebastienlagarde 8 年前
当前提交
ace22e14
共有 2 个文件被更改,包括 3 次插入3 次删除
  1. 4
      Assets/ScriptableRenderLoop/HDRenderLoop/Material/Lit/LitSurfaceData.hlsl
  2. 2
      Assets/ScriptableRenderLoop/ShaderLibrary/AreaLighting.hlsl

4
Assets/ScriptableRenderLoop/HDRenderLoop/Material/Lit/LitSurfaceData.hlsl


#endif
// TODO: think about using BC5
float3 vertexNormalWS = input.tangentToWorld[2].xyz;
float3 vertexNormalWS = normalize(input.tangentToWorld[2].xyz);
#ifdef _NORMALMAP
#ifdef _NORMALMAP_TANGENT_SPACE

surfaceData.tangentWS = SAMPLE_LAYER_TEXTURE2D(ADD_IDX(_TangentMap), ADD_ZERO_IDX(sampler_TangentMap), ADD_IDX(layerTexCoord.base)).rgb;
#endif
#else
surfaceData.tangentWS = input.tangentToWorld[0].xyz;
surfaceData.tangentWS = normalize(input.tangentToWorld[0].xyz);
#endif
// TODO: Is there anything todo regarding flip normal but for the tangent ?

2
Assets/ScriptableRenderLoop/ShaderLibrary/AreaLighting.hlsl


// Clamp to avoid artifacts. This particular constant gives the best results.
cosTheta = Clamp(cosTheta, -0.9999, 0.9999);
float theta = FastACos(cosTheta);
float res = cross(v1, v2).z * theta / sin(theta);
float res = cross(v1, v2).z * theta * rsqrt(1.0f - cosTheta * cosTheta); // optimization from * 1 / sin(theta)
return res;
}

正在加载...
取消
保存