Browse Source

Added in needed normal map processing for preview render

Areloch 4 years ago
parent
commit
16438e1ab3
1 changed files with 4 additions and 1 deletions
  1. 4 1
      Engine/source/shaderGen/HLSL/bumpHLSL.cpp

+ 4 - 1
Engine/source/shaderGen/HLSL/bumpHLSL.cpp

@@ -420,7 +420,10 @@ void NormalsOutFeatHLSL::processVert(  Vector<ShaderComponent*> &componentList,
    {
       // Transform the normal to world space.
       Var *objTrans = getObjTrans( componentList, fd.features[MFT_UseInstancing], meta );
-      meta->addStatement( new GenOp( "   @ = mul( @, normalize( @ ) );\r\n", outNormal, objTrans, inNormal ) );
+      if (String::compare((const char*)objTrans->type, "float4x4") == 0)
+         meta->addStatement(new GenOp("   @ = mul( @, normalize( float4(@,0) ) ).xyz;\r\n", outNormal, objTrans, inNormal));
+      else
+         meta->addStatement(new GenOp("   @ = mul( @, normalize( @ ) );\r\n", outNormal, objTrans, inNormal));
    }
    else
    {