XPbr: remap sphere-map normal decode to signed range for ModelTranslator
This commit is contained in:
@@ -65,9 +65,10 @@ struct Varyings
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
//解码 RG 两通道球面映射压缩法线(与 XTex 的 MixTex 资源格式一致)
|
||||
//解码 RG 两通道球面映射压缩法线(有符号,ModelTranslator 工具编码:enc = n.xy/sqrt(2*(1+n.z)) * 0.5 + 0.5)
|
||||
float3 DecodeSphereMap(float2 encoded)
|
||||
{
|
||||
encoded = encoded * 2.0 - 1.0; //rg 无符号存储,重映射回有符号
|
||||
float4 nn = float4(encoded, 1, -1);
|
||||
float l = dot(nn.xyz, -nn.xyw);
|
||||
nn.z = l;
|
||||
|
||||
Reference in New Issue
Block a user