bInvertNormalMaps

bInvertNormalMaps

#Overview

name: bInvertNormalMaps

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 9 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of bInvertNormalMaps is to control the inversion of the green channel (Y-axis) in normal maps during texture importing in Unreal Engine.

This setting variable is primarily used by the FBX import system and texture import pipeline within Unreal Engine. It’s referenced in several modules and plugins, including:

  1. Interchange Editor Plugin
  2. UnrealEd module (core editor functionality)

The value of this variable is typically set in the following places:

  1. In the FBX import UI settings (UFbxTextureImportData class)
  2. In the FBX scene import options (UFbxSceneImportOptions class)
  3. Through Blueprint or C++ code when customizing import settings

This variable interacts with other import-related variables, particularly those in the FBX and texture import settings. It’s often used alongside other texture and material import options.

Developers should be aware of the following when using this variable:

  1. Inverting normal maps can significantly affect the appearance of imported materials and models.
  2. This setting applies globally to all normal maps imported in a given import operation.
  3. Inconsistent use of this setting across different imports can lead to visual inconsistencies in the project.

Best practices when using this variable include:

  1. Maintain consistency in its usage across all imports for a project to ensure visual coherence.
  2. Document the chosen setting for the project to ensure all team members are aware of the standard.
  3. Be cautious when changing this setting for reimports, as it may affect existing materials and models.
  4. Consider the source of your normal maps and whether they require inversion for correct rendering in Unreal Engine.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:697, section: [/Script/UnrealEd.FbxTextureImportData]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Plugins/Interchange/Editor/Source/InterchangeEditor/Private/InterchangeFbxAssetImportDataConverter.cpp:655

Scope (from outer to inner):

file
namespace    UE::Interchange::Private
function     UAssetImportData* ConvertToInterchange

Source code excerpt:

		//Texture Options
		GenericAssetPipeline->MaterialPipeline->TexturePipeline->bImportTextures = FbxImportUI->bImportTextures;
		GenericAssetPipeline->MaterialPipeline->TexturePipeline->bFlipNormalMapGreenChannel = FbxImportUI->TextureImportData->bInvertNormalMaps;

		//Default the force animation to false
		GenericAssetPipeline->CommonSkeletalMeshesAndAnimationsProperties->bImportOnlyAnimations = false;

		//Discover if we must import something in particular
		if (FbxImportUI->MeshTypeToImport == EFBXImportType::FBXIT_SkeletalMesh

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Factories/FbxSceneImportOptions.h:77

Scope (from outer to inner):

file
class        class UFbxSceneImportOptions : public UObject

Source code excerpt:

	/** If enabled, this option will cause normal map Y (Green) values to be inverted when importing textures */
	UPROPERTY(EditAnywhere, config, category = Texture)
	uint32 bInvertNormalMaps : 1;
};

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Factories/FbxTextureImportData.h:19

Scope (from outer to inner):

file
class        class UFbxTextureImportData : public UFbxAssetImportData

Source code excerpt:

	/** If importing textures is enabled, this option will cause normal map Y (Green) values to be inverted */
	UPROPERTY(EditAnywhere, BlueprintReadWrite, AdvancedDisplay, config, Category=ImportSettings, meta=(OBJRestrict="true"))
	uint32 bInvertNormalMaps:1;

	/** Specify where we should search for matching materials when importing */
	UPROPERTY(EditAnywhere, BlueprintReadWrite, config, Category = ImportSettings, meta = (DisplayName="Search Location", OBJRestrict = "true", ImportType = "Mesh"))
	EMaterialSearchLocation MaterialSearchLocation;

	/** Base material to instance from when importing materials. */

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Fbx/FbxMainImport.cpp:386

Scope (from outer to inner):

file
namespace    UnFbx
function     void ApplyImportUIToImportOptions

Source code excerpt:

	{
		InOutImportOptions.bImportMaterials			= ImportUI->bImportMaterials;
		InOutImportOptions.bInvertNormalMap			= ImportUI->TextureImportData->bInvertNormalMaps;
		InOutImportOptions.MaterialSearchLocation	= ImportUI->TextureImportData->MaterialSearchLocation;
		UMaterialInterface* BaseMaterialInterface	= Cast<UMaterialInterface>(ImportUI->TextureImportData->BaseMaterialName.TryLoad());
		if (BaseMaterialInterface) {
			InOutImportOptions.BaseMaterial			= BaseMaterialInterface;
			InOutImportOptions.BaseColorName		= ImportUI->TextureImportData->BaseColorName;
			InOutImportOptions.BaseDiffuseTextureName = ImportUI->TextureImportData->BaseDiffuseTextureName;

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Fbx/FbxSceneImportFactory.cpp:137

Scope (from outer to inner):

file
function     bool GetFbxSceneImportOptions

Source code excerpt:


	GlobalImportSettings->bBakePivotInVertex = SceneImportOptions->bBakePivotInVertex;
	GlobalImportSettings->bInvertNormalMap = SceneImportOptions->bInvertNormalMaps;

	//TODO this options will be set by the fbxscene UI in the material options tab, it also should be save/load from config file
	//Prefix materials package name to put all material under Material folder (this avoid name clash with meshes)
	GlobalImportSettings->MaterialBasePath = NAME_None;

	GlobalImportSettings->OverrideMaterials.Reset();

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Fbx/FbxSceneImportFactory.cpp:192

Scope (from outer to inner):

file
function     bool GetFbxSceneImportOptions

Source code excerpt:

	GlobalImportSettings->bImportStaticMeshLODs = SceneImportOptions->bImportStaticMeshLODs;
	GlobalImportSettings->bImportSkeletalMeshLODs = SceneImportOptions->bImportSkeletalMeshLODs;
	GlobalImportSettings->bInvertNormalMap = SceneImportOptions->bInvertNormalMaps;
	GlobalImportSettings->ImportTranslation = SceneImportOptions->ImportTranslation;
	GlobalImportSettings->ImportRotation = SceneImportOptions->ImportRotation;
	GlobalImportSettings->ImportUniformScale = SceneImportOptions->ImportUniformScale;

	//Set the override material into the options
	for (TSharedPtr<FFbxNodeInfo> NodeInfo : SceneInfoPtr->HierarchyInfo)

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Fbx/FbxSceneImportOptions.cpp:16

Scope (from outer to inner):

file
function     UFbxSceneImportOptions::UFbxSceneImportOptions

Source code excerpt:

	bImportStaticMeshLODs = false;
	bImportSkeletalMeshLODs = false;
	bInvertNormalMaps = false;
	ImportTranslation = FVector(0);
	ImportRotation = FRotator(0);
	ImportUniformScale = 1.0f;
}

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Fbx/ReimportFbxSceneFactory.cpp:312

Scope (from outer to inner):

file
function     bool GetFbxSceneReImportOptions

Source code excerpt:

	GlobalImportSettings->bImportStaticMeshLODs = SceneImportOptions->bImportStaticMeshLODs;
	GlobalImportSettings->bImportSkeletalMeshLODs = SceneImportOptions->bImportSkeletalMeshLODs;
	SceneImportOptions->bInvertNormalMaps = GlobalImportSettings->bInvertNormalMap;
	GlobalImportSettings->ImportTranslation = SceneImportOptions->ImportTranslation;
	GlobalImportSettings->ImportRotation = SceneImportOptions->ImportRotation;
	GlobalImportSettings->ImportUniformScale = SceneImportOptions->ImportUniformScale;

	//Set the override material into the options
	for (TSharedPtr<FFbxNodeInfo> NodeInfo : SceneInfoPtr->HierarchyInfo)

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Fbx/SFbxSceneOptionWindow.cpp:192

Scope (from outer to inner):

file
function     void SFbxSceneOptionWindow::OnFinishedChangingPropertiesSceneTabDetailView

Source code excerpt:

	GlobalImportSettings->bForceFrontXAxis = SceneImportOptionsDisplay->bForceFrontXAxis;
	GlobalImportSettings->bBakePivotInVertex = SceneImportOptionsDisplay->bBakePivotInVertex;
	GlobalImportSettings->bInvertNormalMap = SceneImportOptionsDisplay->bInvertNormalMaps;
	GlobalImportSettings->ImportTranslation = SceneImportOptionsDisplay->ImportTranslation;
	GlobalImportSettings->ImportRotation = SceneImportOptionsDisplay->ImportRotation;
	GlobalImportSettings->ImportUniformScale = SceneImportOptionsDisplay->ImportUniformScale;
}

TSharedRef<SDockTab> SFbxSceneOptionWindow::SpawnStaticMeshTab(const FSpawnTabArgs& Args)