浏览代码

Merged normal and view direction changes.

/2018.1
Felipe Lira 6 年前
当前提交
7f17ab1e
共有 1 个文件被更改,包括 13 次插入6 次删除
  1. 19
      ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/LightweightPassLit.hlsl

19
ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/LightweightPassLit.hlsl


#else
half3 viewDir = IN.viewDir;
#if !SHADER_HINT_NICE_QUALITY
// World normal is already normalized in vertex. Small acceptable error to save ALU.
inputData.normalWS = IN.normal;
#else
inputData.normalWS = normalize(IN.normal);

#if !SHADER_HINT_NICE_QUALITY
// viewDirection should be normalized here, but we avoid doing it as it's close enough and we save some ALU.
inputData.viewDirectionWS = viewDir;
#if SHADER_HINT_NICE_QUALITY
inputData.viewDirectionWS = SafeNormalize(viewDir);
inputData.viewDirectionWS = normalize(viewDir);
// View direction is already normalized in vertex. Small acceptable error to save ALU.
inputData.viewDirectionWS = viewDir;
#endif
inputData.shadowCoord = IN.shadowCoord;

o.posWS = TransformObjectToWorld(v.vertex.xyz);
o.clipPos = TransformWorldToHClip(o.posWS);
half3 viewDir = GetCameraPositionWS() - o.posWS;
#if !SHADER_HINT_NICE_QUALITY
// Normalize in vertex and avoid renormalizing it in frag to save ALU.
viewDir = SafeNormalize(viewDir);
#endif
half3 viewDir = SafeNormalize(GetCameraPositionWS() - o.posWS);
o.viewDir = SafeNormalize(GetCameraPositionWS() - o.posWS);
o.viewDir = viewDir;
#endif
// initializes o.normal and if _NORMALMAP also o.tangent and o.binormal

正在加载...
取消
保存