From 16438e1ab39539f47602d12e460ea7342e213bd4 Mon Sep 17 00:00:00 2001 From: Areloch Date: Wed, 27 Jan 2021 12:26:33 -0600 Subject: [PATCH] Added in needed normal map processing for preview render --- Engine/source/shaderGen/HLSL/bumpHLSL.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Engine/source/shaderGen/HLSL/bumpHLSL.cpp b/Engine/source/shaderGen/HLSL/bumpHLSL.cpp index b495da61e..c916d8b38 100644 --- a/Engine/source/shaderGen/HLSL/bumpHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/bumpHLSL.cpp @@ -420,7 +420,10 @@ void NormalsOutFeatHLSL::processVert( Vector &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 {