modeling.DisableAutoUVAreaDensitySampling

modeling.DisableAutoUVAreaDensitySampling

#Overview

name: modeling.DisableAutoUVAreaDensitySampling

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of modeling.DisableAutoUVAreaDensitySampling is to control the behavior of the AutoUV’s PatchBuilder algorithm in the mesh parameterization process. Specifically, it allows switching between the current and legacy behavior of the algorithm.

This setting variable is primarily used in the GeometryProcessing plugin, specifically in the DynamicMesh module. It directly affects the mesh UV generation process, which is a crucial part of 3D modeling and texturing in Unreal Engine.

The value of this variable is set through a console variable (CVar) system. It’s defined as a TAutoConsoleVariable with a default value of 0.

The associated variable CVarEnableAutoUVAreaDensitySampling interacts directly with modeling.DisableAutoUVAreaDensitySampling. They share the same value and are used interchangeably in the code.

Developers must be aware that setting this variable to a non-zero value will revert the PatchBuilder algorithm to its legacy behavior. This could potentially affect UV mapping quality and performance in certain scenarios.

Best practices when using this variable include:

  1. Understanding the implications of switching between current and legacy behaviors.
  2. Testing thoroughly after changing this setting, as it can significantly impact UV generation.
  3. Considering performance impacts, as the area density sampling method may be more computationally intensive.
  4. Documenting any changes to this setting in project documentation for other team members.

Regarding the associated variable CVarEnableAutoUVAreaDensitySampling:

Its purpose is to provide a more intuitive name for the same functionality as modeling.DisableAutoUVAreaDensitySampling. It’s used to determine whether to use area density sampling in the UV generation process.

This variable is used in the same GeometryProcessing plugin and DynamicMesh module.

Its value is set indirectly through modeling.DisableAutoUVAreaDensitySampling, as they share the same underlying value.

Developers should be aware that despite its name suggesting “enabling”, a value of 0 actually enables the area density sampling, while a non-zero value disables it.

Best practices for this variable are the same as for modeling.DisableAutoUVAreaDensitySampling, with the additional note to be cautious of the counterintuitive naming convention.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Runtime/GeometryProcessing/Source/DynamicMesh/Private/Parameterization/PatchBasedMeshUVGenerator.cpp:121

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarEnableAutoUVAreaDensitySampling(
	TEXT("modeling.DisableAutoUVAreaDensitySampling"),
	0,
	TEXT("If set, return the behavior of AutoUV's PatchBuilder algorithm to the legacy behavior."));

bool FPatchBasedMeshUVGenerator::ComputeInitialMeshPatches(
	FDynamicMesh3& TargetMesh,
	FMeshConnectedComponents& InitialComponentsOut,

#Associated Variable and Callsites

This variable is associated with another variable named CVarEnableAutoUVAreaDensitySampling. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Plugins/Runtime/GeometryProcessing/Source/DynamicMesh/Private/Parameterization/PatchBasedMeshUVGenerator.cpp:120

Scope: file

Source code excerpt:

}

static TAutoConsoleVariable<int32> CVarEnableAutoUVAreaDensitySampling(
	TEXT("modeling.DisableAutoUVAreaDensitySampling"),
	0,
	TEXT("If set, return the behavior of AutoUV's PatchBuilder algorithm to the legacy behavior."));

bool FPatchBasedMeshUVGenerator::ComputeInitialMeshPatches(
	FDynamicMesh3& TargetMesh,

#Loc: <Workspace>/Engine/Plugins/Runtime/GeometryProcessing/Source/DynamicMesh/Private/Parameterization/PatchBasedMeshUVGenerator.cpp:138

Scope (from outer to inner):

file
function     bool FPatchBasedMeshUVGenerator::ComputeInitialMeshPatches

Source code excerpt:

	FVector3d GeneratorParams(this->PatchNormalWeight, 1.0, 1.0);

	bool bUseAreaDensitySampling = (CVarEnableAutoUVAreaDensitySampling.GetValueOnAnyThread() == 0);
	bool bOK = false;
	if (bUseAreaDensitySampling)
	{
		bOK = Generator.FindPolygroupsFromAreaDensityPointSampling(this->TargetPatchCount, WeightType, GeneratorParams, this->GroupConstraint);
	}
	else