Timmy Posted February 16, 2015 Share Posted February 16, 2015 (edited) AboutThis resource will flip(invert) the green channel of the normal map. It doesn't actually touch the image but will invert the expanded normal map's green channel in the pixel shader. In other words it will flip the direction of the bumps in your normal map. I have not modified the GUI here so it's script only. Only tested on advanced lightingMaterial Script Usage invertNormalMap = true; ImplementationSource File: Engine/source/materials/materialFeatureTypes.h After Line: 89/// This feature flips the green channel of the normal map DeclareFeatureType( MFT_InvertNormalMap ); Source File: Engine/source/materials/materialFeatureTypes.cpp After Line: 62ImplementFeatureType( MFT_InvertNormalMap, U32(-1), -1, true ); Source File: Engine/source/materials/materialDefinition.h After Line: 282bool mInvertNormalMap; Source File: Engine/source/materials/materialDefinition.cppAfter Line: 197mInvertNormalMap = false;After Line: 367addField( "invertNormalMap", TypeBool, Offset(mInvertNormalMap, Material), "If true this will flip(invert) the normal map/s green channel of this material." ); Source File: Engine/source/materials/processedShaderMaterial.cppAfter Line: 388if(mMaterial->mInvertNormalMap) fd.features.addFeature( MFT_InvertNormalMap ); Source File: Engine/source/renderInstance/renderPrePassMgr.cppAfter Line: 554type == MFT_InvertNormalMap || Source File: Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cppAfter Line: 178if( fd.features.hasFeature( MFT_InvertNormalMap )) meta->addStatement( new GenOp( " @.y *= -1.0;\r\n", normalVar ) ); Source File: Engine/source/shaderGen/HLSL/shaderGenHLSLInit.cppAfter Line: 48FEATUREMGR->registerFeature( MFT_InvertNormalMap, new NamedFeatureHLSL( "Invert Normal Map" ) ); ConsequencesThis will create yet another shader permutation in the ShaderGen system. Edited February 16, 2015 by Timmy Quote Link to comment Share on other sites More sharing options...
Timmy Posted February 16, 2015 Author Share Posted February 16, 2015 Not sure if this should be in this section or Assets Quote Link to comment Share on other sites More sharing options...
LukasPJ Posted February 16, 2015 Share Posted February 16, 2015 I'm not sure either.. Thinking thinking.. Maybe a graphics or visuals subforum needs to be made.Edit: moved to a new forum. Quote Link to comment Share on other sites More sharing options...
Duion Posted February 17, 2015 Share Posted February 17, 2015 Nice feature, but I fear that this can cause even more confusion with the T3D normal maps. The normal maps in T3D should be hard coded to be one standard, like y-inverted, so you don't get tempted to flip them all the time. Quote Link to comment Share on other sites More sharing options...
Timmy Posted February 18, 2015 Author Share Posted February 18, 2015 Exactly why i didn't offer this as an official pull request but added it as a resource instead ;) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.