p.LevelSetOutputFailedDebugData

p.LevelSetOutputFailedDebugData

#Overview

name: p.LevelSetOutputFailedDebugData

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

It is referenced in 6 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of p.LevelSetOutputFailedDebugData is to control the output of debug data for level sets in Unreal Engine’s Chaos physics system. This setting is specifically used when error tolerances in level set calculations are exceeded.

This setting variable is primarily used in the Chaos module, which is part of Unreal Engine’s experimental physics system. It’s referenced in the Levelset.cpp file, indicating its relevance to level set computations in the physics simulation.

The value of this variable is set through the Unreal Engine console variable system. It’s declared as an integer and initialized to 0, suggesting it’s a boolean flag (0 for false, non-zero for true).

The associated variable OutputFailedLevelSetDebugData directly interacts with p.LevelSetOutputFailedDebugData. They share the same value, with OutputFailedLevelSetDebugData being the actual variable used in the code logic.

Developers must be aware that enabling this debug output may impact performance, as it generates additional debug files when level set errors occur. It’s primarily intended for debugging and development purposes.

Best practices for using this variable include:

  1. Only enable it when debugging level set issues.
  2. Be prepared to handle and analyze the generated debug files.
  3. Disable it in production builds to avoid unnecessary performance overhead.

Regarding the associated variable OutputFailedLevelSetDebugData:

The purpose of OutputFailedLevelSetDebugData is to serve as the actual flag checked in the code to determine whether to output debug data for failed level sets.

It’s used in the Chaos physics system, specifically in the level set computation and validation process.

The value is set through the console variable system, linked to p.LevelSetOutputFailedDebugData.

This variable is checked in multiple places within the FLevelSet::CheckData function to determine whether to call OutputDebugData when various error conditions are met.

Developers should be aware that this variable controls the generation of potentially large debug files, which could impact performance and disk usage.

Best practices include using this variable judiciously during development and testing, and ensuring it’s disabled in production builds to prevent unnecessary debug output and performance impact.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Levelset.cpp:17

Scope: file

Source code excerpt:


int32 OutputFailedLevelSetDebugData = 0;
FAutoConsoleVariableRef CVarOutputFailedLevelSetDebugData(TEXT("p.LevelSetOutputFailedDebugData"), OutputFailedLevelSetDebugData, TEXT("Output debug obj files for level set and mesh when error tolerances are too high"));

int32 FailureOnHighError = 0;
FAutoConsoleVariableRef CVarFailureOnHighError(TEXT("p.LevelSetFailureOnHighError"), FailureOnHighError, TEXT("Set level sets with high error to null in the solver"));

Chaos::FRealSingle AvgDistErrorTolerance = 1.f;
FAutoConsoleVariableRef CVarAvgDistErrorTolerance(TEXT("p.LevelSetAvgDistErrorTolerance"), AvgDistErrorTolerance, TEXT("Error tolerance for average distance between the triangles and generated levelset.  Note this is a fraction of the average bounding box dimensions."));

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Levelset.cpp:16

Scope: file

Source code excerpt:

#include "Chaos/GeometryQueries.h"

int32 OutputFailedLevelSetDebugData = 0;
FAutoConsoleVariableRef CVarOutputFailedLevelSetDebugData(TEXT("p.LevelSetOutputFailedDebugData"), OutputFailedLevelSetDebugData, TEXT("Output debug obj files for level set and mesh when error tolerances are too high"));

int32 FailureOnHighError = 0;
FAutoConsoleVariableRef CVarFailureOnHighError(TEXT("p.LevelSetFailureOnHighError"), FailureOnHighError, TEXT("Set level sets with high error to null in the solver"));

Chaos::FRealSingle AvgDistErrorTolerance = 1.f;
FAutoConsoleVariableRef CVarAvgDistErrorTolerance(TEXT("p.LevelSetAvgDistErrorTolerance"), AvgDistErrorTolerance, TEXT("Error tolerance for average distance between the triangles and generated levelset.  Note this is a fraction of the average bounding box dimensions."));

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Levelset.cpp:542

Scope (from outer to inner):

file
namespace    Chaos
function     bool FLevelSet::CheckData

Source code excerpt:

		if (MNormals[i].ContainsNaN() || !FMath::IsFinite(MPhi[i]) || FMath::IsNaN(MPhi[i]))
		{
			if (OutputFailedLevelSetDebugData)
			{
				OutputDebugData(ErrorReporter, InParticles, Normals, Mesh, FString::Printf(TEXT("NANS___")) + ObjectNamePrefixNoSpace);
			}

			ErrorReporter.ReportError(TEXT("NaNs were found in level set data.  Check input geometry and resolution settings."));
			return false;

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Levelset.cpp:557

Scope (from outer to inner):

file
namespace    Chaos
function     bool FLevelSet::CheckData

Source code excerpt:

	if (!hasInterior)
	{
		if (OutputFailedLevelSetDebugData)
		{
			OutputDebugData(ErrorReporter, InParticles, Normals, Mesh, FString::Printf(TEXT("NOINTERIOR___")) + ObjectNamePrefixNoSpace);
		}

		ErrorReporter.ReportError(TEXT("No interior voxels (phi < 0) defined on level set"));
		return false;

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Levelset.cpp:568

Scope (from outer to inner):

file
namespace    Chaos
function     bool FLevelSet::CheckData

Source code excerpt:

	if (!hasExterior)
	{
		if (OutputFailedLevelSetDebugData)
		{
			OutputDebugData(ErrorReporter, InParticles, Normals, Mesh, FString::Printf(TEXT("NOEXTERIOR___")) + ObjectNamePrefixNoSpace);
		}

		ErrorReporter.ReportError(TEXT("No exterior voxels (phi > 0) defined on level set"));
		return false;

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Levelset.cpp:584

Scope (from outer to inner):

file
namespace    Chaos
function     bool FLevelSet::CheckData

Source code excerpt:

	if (AvgDistError > AvgDistErrorTolerance*MGrid.Dx().Size() || AvgAngleError > AvgAngleErrorTolerance || MaxDistError > MaxDistErrorTolerance*MGrid.Dx().Size())
	{
		if (OutputFailedLevelSetDebugData)
		{
			FString Prefix = FString::Printf(TEXT("AVGDIST_%f__MAXDIST_%f__ANGLE_%f___"), AvgDistError, MaxDistError, AvgAngleError) + ObjectNamePrefixNoSpace;
			OutputDebugData(ErrorReporter, InParticles, Normals, Mesh, Prefix);
		}

		if (FailureOnHighError)