浏览代码

Merge pull request #513 from Unity-Technologies/Branch_FixLayeredWind

Branch Fix Layered Wind
/Yibing-Project-2
GitHub 7 年前
当前提交
41219331
共有 1 个文件被更改,包括 14 次插入2 次删除
  1. 16
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitData.hlsl

16
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitData.hlsl


// Settings this specific Main layer blend mask in alpha allow to be transparent in case we don't use it and 1 is provide by default.
float4 blendMasks = useLodSampling ? SAMPLE_UVMAPPING_TEXTURE2D_LOD(_LayerMaskMap, sampler_LayerMaskMap, layerTexCoord.blendMask, lod) : SAMPLE_UVMAPPING_TEXTURE2D(_LayerMaskMap, sampler_LayerMaskMap, layerTexCoord.blendMask);
// Wind uses vertex alpha as an intensity parameter.
// So in case Layered shader uses wind, we need to hardcode the alpha here so that the main layer can be visible without affecting wind intensity.
// It also means that when using wind, users can't use vertex color to modulate the effect of influence from the main layer.
float4 maskVertexColor = vertexColor;
blendMasks *= vertexColor;
#if defined(_VERTEX_WIND)
// For multiplicative vertex color blend mask. 1.0f is the neutral value
maskVertexColor.a = 1.0f;
#endif
blendMasks *= maskVertexColor;
blendMasks = saturate(blendMasks + vertexColor * 2.0 - 1.0);
#if defined(_VERTEX_WIND)
// For additive vertex color blend mask. 0.5f is the neutral value (0.5 * 2.0 - 1.0 = 0.0)
maskVertexColor.a = 0.5f;
#endif
blendMasks = saturate(blendMasks + maskVertexColor * 2.0 - 1.0);
#endif
return blendMasks;

正在加载...
取消
保存