From e784b0140c32f2de6c5ca7ac5d23d3961cb28d00 Mon Sep 17 00:00:00 2001 From: Jeff Hutchinson Date: Wed, 22 Sep 2021 21:41:38 -0400 Subject: [PATCH] Let's fix the texcoord alignment for RT Lighting. --- .../source/shaderGen/GLSL/shaderFeatureGLSL.cpp | 16 +++++++--------- .../source/shaderGen/HLSL/shaderFeatureHLSL.cpp | 12 +++++------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp index 0cf46277c..e9604eb77 100644 --- a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp +++ b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp @@ -2090,12 +2090,15 @@ void RTLightingFeatGLSL::processVert( Vector &componentList, return; } - + + addOutWsPosition( componentList, fd.features[MFT_UseInstancing], meta ); + getOutWorldToTangent(componentList, meta, fd); + + output = meta; + // Find the incoming vertex normal. Var *inNormal = (Var*)LangElement::find( "normal" ); - - // Skip out on realtime lighting if we don't have a normal - // or we're doing some sort of baked lighting. + if ( !inNormal || fd.features[MFT_LightMap] || fd.features[MFT_ToneMap] || @@ -2119,11 +2122,6 @@ void RTLightingFeatGLSL::processVert( Vector &componentList, meta->addStatement( new GenOp( " @ = tMul( @, vec4( normalize( @ ), 0.0 ) ).xyz;\r\n", outNormal, objTrans, inNormal ) ); }*/ - addOutWsPosition( componentList, fd.features[MFT_UseInstancing], meta ); - - getOutWorldToTangent(componentList, meta, fd); - - output = meta; } void RTLightingFeatGLSL::processPix( Vector &componentList, diff --git a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp index 1ebc3982a..dfdb5439c 100644 --- a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp @@ -2178,11 +2178,14 @@ void RTLightingFeatHLSL::processVert( Vector &componentList, return; } + addOutWsPosition( componentList, fd.features[MFT_UseInstancing], meta ); + getOutWorldToTangent(componentList, meta, fd); + output = meta; + + // Find the incoming vertex normal. Var *inNormal = (Var*)LangElement::find( "normal" ); - // Skip out on realtime lighting if we don't have a normal - // or we're doing some sort of baked lighting. if ( !inNormal || fd.features[MFT_LightMap] || fd.features[MFT_ToneMap] || @@ -2205,11 +2208,6 @@ void RTLightingFeatHLSL::processVert( Vector &componentList, // Transform the normal to world space. meta->addStatement( new GenOp( " @ = mul( @, float4( normalize( @ ), 0.0 ) ).xyz;\r\n", outNormal, objTrans, inNormal ) ); } - - addOutWsPosition( componentList, fd.features[MFT_UseInstancing], meta ); - getOutWorldToTangent(componentList, meta, fd); - - output = meta; } void RTLightingFeatHLSL::processPix( Vector &componentList,