World Normal Node generate bad code.
Posted: Tue Jan 30, 2018 4:30 am
Hello.
I transform normal map to world space.
ASE generate bad code.
I Test Default Unlit shader type.
I make [Texture sampler] node. and It set to [World Normal] node input.
3 Texture sample is terrible result.
(test on v1.4.3 dev 01)
fixed4 frag (v2f i ) : SV_Target
{
fixed4 myColorVar;
// ase common template code
float2 uv_TextureSample0 = i.texcoord.xy * _TextureSample0_ST.xy + _TextureSample0_ST.zw;
float3 tanToWorld0 = i.ase_texcoord1.xyz;
float3 tanToWorld1 = i.ase_texcoord2.xyz;
float3 tanToWorld2 = i.ase_texcoord3.xyz;
float3 worldNormal2 = float3(dot(tanToWorld0,tex2D( _TextureSample0, uv_TextureSample0 ).rgb), dot(tanToWorld1,tex2D( _TextureSample0, uv_TextureSample0 ).rgb), dot(tanToWorld2,tex2D( _TextureSample0, uv_TextureSample0 ).rgb));
myColorVar = float4( worldNormal2 , 0.0 );
return myColorVar;
}
I transform normal map to world space.
ASE generate bad code.
I Test Default Unlit shader type.
I make [Texture sampler] node. and It set to [World Normal] node input.
3 Texture sample is terrible result.
(test on v1.4.3 dev 01)
fixed4 frag (v2f i ) : SV_Target
{
fixed4 myColorVar;
// ase common template code
float2 uv_TextureSample0 = i.texcoord.xy * _TextureSample0_ST.xy + _TextureSample0_ST.zw;
float3 tanToWorld0 = i.ase_texcoord1.xyz;
float3 tanToWorld1 = i.ase_texcoord2.xyz;
float3 tanToWorld2 = i.ase_texcoord3.xyz;
float3 worldNormal2 = float3(dot(tanToWorld0,tex2D( _TextureSample0, uv_TextureSample0 ).rgb), dot(tanToWorld1,tex2D( _TextureSample0, uv_TextureSample0 ).rgb), dot(tanToWorld2,tex2D( _TextureSample0, uv_TextureSample0 ).rgb));
myColorVar = float4( worldNormal2 , 0.0 );
return myColorVar;
}