You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Get the texel in the normal map
fixed4 packedNormal = tex2D(_BumpMap, i.uv.zw);
fixed3 tangentNormal;
// If the texture is not marked as "Normal map"
在源码中片元着色其是这样的:
fixed4 frag(v2f i) : SV_Target {
fixed3 tangentLightDir = normalize(i.lightDir);
fixed3 tangentViewDir = normalize(i.viewDir);
// tangentNormal.xy = (packedNormal.xy * 2 - 1) * _BumpScale;
// tangentNormal.z = sqrt(1.0 - saturate(dot(tangentNormal.xy, tangentNormal.xy)));
示例中贴图的Texture Type已选择为Normal map
有如下疑惑
1.以上代码中手动反映射法线和调用UnpackNormal反映射似乎没什么区别
2.在UnpackNormal中已根据压缩格式对反映射做了处理,包括z分量,为什么在调用UnpackNormal后还要再计算一次z分量
我尝试把这一行注释掉,但是高光部分似乎变暗了些,我不知道什么才是正确,希望大佬们解答一下,十分感谢
The text was updated successfully, but these errors were encountered: