浏览代码

Optimize EvaluateCookie_Punctual()

/main
Evgenii Golubev 7 年前
当前提交
3367958a
共有 1 个文件被更改,包括 11 次插入1 次删除
  1. 12
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl

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


// Box projector lights require no perspective division.
float perspectiveZ = (lightType != GPULIGHTTYPE_PROJECTOR_BOX) ? positionLS.z : 1.0;
float2 positionCS = positionLS.xy / perspectiveZ;
bool isInBounds = Max3(abs(positionCS.x), abs(positionCS.y), 1.0 - positionLS.z) <= 1.0;
bool isInBounds;
if (lightData.lightType == GPULIGHTTYPE_SPOT)
{
isInBounds = max(abs(positionCS.x), abs(positionCS.y)) <= 1.0;
}
else
{
isInBounds = Max3(abs(positionCS.x), abs(positionCS.y), 1.0 - positionLS.z) <= 1.0;
}
// Remap the texture coordinates from [-1, 1]^2 to [0, 1]^2.
float2 positionNDC = positionCS * 0.5 + 0.5;

正在加载...
取消
保存