LevelOfDetail
LevelOfDetail
#Overview
name: LevelOfDetail
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 LevelOfDetail is to control the export of multiple levels of detail (LODs) for 3D models in Unreal Engine 5. This setting is primarily used in the FBX export process for both static and skeletal meshes.
This setting variable is primarily used in the Unreal Engine’s FBX export system, which is part of the UnrealEd module. It’s also referenced in the experimental HairCardGenerator plugin.
The value of this variable is typically set in the FBX export options. In the UFbxExportOption
constructor (FbxExportOption.cpp
), it’s initialized to true
by default.
LevelOfDetail interacts with other export-related variables such as Collision
, bExportSourceMesh
, and ExportLOD
. It’s often used in conditional statements to determine whether to export multiple LODs or just the base mesh.
Developers should be aware that:
- When LevelOfDetail is true, the exporter will create an FBX LOD Group node and export all available LODs for the mesh.
- It affects both static and skeletal mesh exports.
- It can impact export performance and file size, especially for models with many LODs.
Best practices when using this variable include:
- Enable it when you need to preserve LOD information in the exported FBX file.
- Consider disabling it if you’re only interested in exporting the base mesh or if you’re trying to minimize export time and file size.
- Be aware of how it interacts with other export options, especially
bExportSourceMesh
andCollision
. - When working with the HairCardGenerator plugin, consider how this setting might affect the hair card generation pipeline.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:72, section: [/Script/UnrealEd.FbxExportOption]
- INI Section:
/Script/UnrealEd.FbxExportOption
- Raw value:
True
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Experimental/HairCardGenerator/Source/HairCardGeneratorEditor/Private/HairCardGeneratorPluginSettings.h:71
Scope: file
Source code excerpt:
| (uint8)EHairCardGenerationPipeline::ImportTextures,
Asset = All,
LevelOfDetail = All,
Randomness = All,
Cards = All,
Geometry = (uint8)EHairCardGenerationPipeline::GeometryGeneration
| (uint8)EHairCardGenerationPipeline::TextureClustering
| (uint8)EHairCardGenerationPipeline::TextureLayout
| (uint8)EHairCardGenerationPipeline::TextureRendering
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Exporters/FbxExportOption.h:59
Scope (from outer to inner):
file
class class UFbxExportOption : public UObject
Source code excerpt:
/** If enabled, export the level of detail */
UPROPERTY(EditAnywhere, BlueprintReadWrite, config, category = Mesh)
uint32 LevelOfDetail : 1;
/** If enabled, export collision */
UPROPERTY(EditAnywhere, BlueprintReadWrite, config, category = StaticMesh, meta = (EditCondition = "!bExportSourceMesh"))
uint32 Collision : 1;
/*
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Fbx/FbxAnimationExport.cpp:474
Scope (from outer to inner):
file
namespace UnFbx
function FbxNode* FFbxExporter::ExportAnimSequence
Source code excerpt:
FbxNode* MeshRootNode = nullptr;
if (GetExportOptions()->LevelOfDetail && SkelMesh->GetLODNum() > 1)
{
FString LodGroup_MeshName = MeshNodeName + TEXT("_LodGroup");
MeshRootNode = FbxNode::Create(Scene, TCHAR_TO_UTF8(*LodGroup_MeshName));
TmpNodeNoTransform->AddChild(MeshRootNode);
LodGroup_MeshName = MeshNodeName + TEXT("_LodGroupAttribute");
FbxLODGroup *FbxLodGroupAttribute = FbxLODGroup::Create(Scene, TCHAR_TO_UTF8(*LodGroup_MeshName));
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Fbx/FbxExportOption.cpp:21
Scope (from outer to inner):
file
function UFbxExportOption::UFbxExportOption
Source code excerpt:
bASCII = false;
bForceFrontXAxis = false;
LevelOfDetail = true;
Collision = true;
bExportSourceMesh = false;
bExportMorphTargets = true;
VertexColor = true;
MapSkeletalMotionToRoot = false;
bExportLocalTime = true;
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Fbx/FbxMainExport.cpp:222
Scope (from outer to inner):
file
namespace UnFbx
function void FFbxExporter::FillExportOptions
Source code excerpt:
{
ExportOptionsUI->Collision = false;
ExportOptionsUI->LevelOfDetail = false;
}
ExportOptionsUI->SaveOptions();
if (FbxOptionWindow->ShouldExport())
{
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Fbx/FbxMainExport.cpp:919
Scope (from outer to inner):
file
namespace UnFbx
function void FFbxExporter::ExportStaticMesh
Source code excerpt:
FColorVertexBuffer* ColorBuffer = NULL;
if(GetExportOptions()->LevelOfDetail && StaticMesh->GetNumLODs() > 1)
{
//Create a fbx LOD Group node
FbxNode* FbxActor = ExportActor(Actor, false, NodeNameAdapter);
FString FbxLODGroupName = NodeNameAdapter.GetActorNodeName(Actor);
FbxLODGroupName += TEXT("_LodGroup");
FbxLODGroupName = GetFbxObjectName(FbxLODGroupName, NodeNameAdapter);
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Fbx/FbxMainExport.cpp:1178
Scope (from outer to inner):
file
namespace UnFbx
function void FFbxExporter::ExportStaticMesh
Source code excerpt:
Scene->GetRootNode()->AddChild(MeshNode);
if (GetExportOptions()->LevelOfDetail && StaticMesh->GetNumLODs() > 1)
{
FString LodGroup_MeshName = MeshName + ("_LodGroup");
FbxLODGroup *FbxLodGroupAttribute = FbxLODGroup::Create(Scene, TCHAR_TO_UTF8(*LodGroup_MeshName));
MeshNode->AddNodeAttribute(FbxLodGroupAttribute);
FbxLodGroupAttribute->ThresholdsUsedAsPercentage = true;
//Export an Fbx Mesh Node for every LOD and child them to the fbx node (LOD Group)
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Fbx/FbxMainExport.cpp:4978
Scope (from outer to inner):
file
namespace UnFbx
function FbxNode* FFbxExporter::ExportStaticMeshToFbx
Source code excerpt:
int32 LodIndex = ExportLOD == INDEX_NONE ? 0 : ExportLOD;
bool bExportSourceMesh = GetExportOptions()->bExportSourceMesh && !GetExportOptions()->LevelOfDetail && !GetExportOptions()->Collision;
const bool bUseNaniteData = LodIndex == 0 && StaticMesh->IsNaniteEnabled() && StaticMesh->IsHiResMeshDescriptionValid();
const bool bUseLodData = !bUseNaniteData && StaticMesh->IsMeshDescriptionValid(LodIndex);
bExportSourceMesh &= (bUseNaniteData || bUseLodData);
if (bExportSourceMesh)
{
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Fbx/FbxSkeletalMeshExport.cpp:694
Scope (from outer to inner):
file
namespace UnFbx
function FbxNode* FFbxExporter::ExportSkeletalMeshToFbx
Source code excerpt:
FbxNode* MeshRootNode = nullptr;
if (GetExportOptions()->LevelOfDetail && SkeletalMesh->GetLODNum() > 1)
{
FString LodGroup_MeshName = FString(MeshName) + TEXT("_LodGroup");
MeshRootNode = FbxNode::Create(Scene, TCHAR_TO_UTF8(*LodGroup_MeshName));
TmpNodeNoTransform->AddChild(MeshRootNode);
LodGroup_MeshName = FString(MeshName) + TEXT("_LodGroupAttribute");
FbxLODGroup *FbxLodGroupAttribute = FbxLODGroup::Create(Scene, TCHAR_TO_UTF8(*LodGroup_MeshName));