Invert Normal Map

5 posts Page 1 of 1
Posts: 378
Joined: Thu Feb 05, 2015 3:20 am
by Timmy » Mon Feb 16, 2015 2:11 pm

This 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 lighting

Material Script Usage
invertNormalMap = true;

Source 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: 62
ImplementFeatureType( MFT_InvertNormalMap, U32(-1), -1, true );
Source File: Engine/source/materials/materialDefinition.h
After Line: 282
bool mInvertNormalMap;
Source File: Engine/source/materials/materialDefinition.cpp
After Line: 197
mInvertNormalMap = false;
After Line: 367
addField( "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.cpp
After Line: 388
   fd.features.addFeature( MFT_InvertNormalMap );
Source File: Engine/source/renderInstance/renderPrePassMgr.cpp
After Line: 554
type == MFT_InvertNormalMap ||
Source File: Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp
After Line: 178
if( fd.features.hasFeature( MFT_InvertNormalMap ))
   meta->addStatement( new GenOp( "   @.y *= -1.0;\r\n", normalVar ) );
Source File: Engine/source/shaderGen/HLSL/shaderGenHLSLInit.cpp
After Line: 48
FEATUREMGR->registerFeature( MFT_InvertNormalMap, new NamedFeatureHLSL( "Invert Normal Map" ) );

This will create yet another shader permutation in the ShaderGen system.
Last edited by Timmy on Mon Feb 16, 2015 2:18 pm, edited 2 times in total.
Posts: 378
Joined: Thu Feb 05, 2015 3:20 am
by Timmy » Mon Feb 16, 2015 2:12 pm
Not sure if this should be in this section or Assets
Site Admin
Posts: 444
Joined: Tue Feb 03, 2015 7:25 pm
by LukasPJ » Mon Feb 16, 2015 2:15 pm
I'm not sure either.. Thinking thinking.. Maybe a graphics or visuals subforum needs to be made.
Edit: moved to a new forum.
Posts: 1626
Joined: Sun Feb 08, 2015 1:51 am
by Duion » Tue Feb 17, 2015 4:25 pm
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.
Posts: 378
Joined: Thu Feb 05, 2015 3:20 am
  by Timmy » Wed Feb 18, 2015 4:01 am
Exactly why i didn't offer this as an official pull request but added it as a resource instead ;)
5 posts Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest