我希望让3D纹理对象的不亮区域变为特定的颜色。
希望这张照片可以解释得更好一点。
到目前为止,我发现了一个可以将未点亮区域透明的着色器,这很酷但不完全正确。我很确定将这个变成特定的颜色而不是透明不是一个很大的延伸,你有任何指针或建议来获得这种效果吗?或者如果你知道一个已经做到这一点的着色器会很棒!
(这是使着色透明的着色器)
http://answers.unity3d.com/questions/283985/a-shader-with-transparent-lit-area.html
非常感谢!
答案 0 :(得分:1)
听起来你只是想要' lerp'你的" unlitColor"和" litColor"使用dot(normal,lightDirection)作为lerp因子。
类似的东西:
float nDotL = saturate(dot(surfaceNormal, vectorToLight));
float3 unlitColor = float3(0, 0, 0.5); // Or whatever color you like
float3 litColor = colorFromTheTexture;
float3 finalColor = lerp(unlitColor, litColor, nDotL);