BrushFalloff

BrushFalloff

#Overview

name: BrushFalloff

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 11 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of BrushFalloff is to control the falloff effect at the edge of a brush in various tools and systems within Unreal Engine 5. It is primarily used in landscape editing, sculpting, and brush-based operations.

This setting variable is utilized by several Unreal Engine subsystems and modules:

  1. Landscape Editor: The LandscapeEditorObject uses BrushFalloff for both heightmap and weightmap editing.
  2. Interactive Tools Framework: The BrushStampIndicator in the InteractiveToolsFramework uses BrushFalloff for visual representation of brush effects.
  3. Mesh Modeling Tools: The KelvinletBrushOp in the MeshModelingToolsetExp plugin uses BrushFalloff for sculpting operations.

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

  1. Through the Unreal Editor UI, as indicated by the UPROPERTY declarations.
  2. Loaded from and saved to the GEditorPerProjectIni configuration file.
  3. Programmatically set in various tool implementations.

BrushFalloff interacts with other variables such as BrushRadius, PaintBrushFalloff, and BrushPosition. It is often used in conjunction with these variables to define the brush’s behavior and appearance.

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

  1. The value is typically clamped between 0 and 1, where 0 means no falloff and 1 means complete falloff.
  2. Different tools may interpret and apply the falloff value differently.
  3. The variable may have different names or slight variations depending on the specific tool or system (e.g., BrushFalloff vs. PaintBrushFalloff).

Best practices when using this variable include:

  1. Provide user-friendly UI controls for adjusting the falloff, typically using a slider.
  2. Consider the interaction between falloff and other brush parameters like radius and strength.
  3. Implement proper clamping and validation to ensure the value stays within the expected range.
  4. Use consistent naming conventions across related tools and systems to avoid confusion.
  5. Document the specific behavior and impact of the falloff for each tool or system that uses it.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:728, section: [LandscapeEdit]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Experimental/MeshModelingToolsetExp/Source/MeshModelingToolsExp/Private/Sculpting/KelvinletBrushOp.h:487

Scope (from outer to inner):

file
class        class FKelvinletBrushOp
function     FKelvinletBrushOpProperties

Source code excerpt:

	struct FKelvinletBrushOpProperties
	{
		FKelvinletBrushOpProperties(const EKelvinletBrushMode& BrushMode, const UKelvinBrushProperties& Properties, double BrushRadius, double BrushFalloff) 
			: Mode(BrushMode)
			, Direction(1.0, 0.0, 0.0)
		{
			Speed = 0.;
			FallOff = BrushFalloff;
			Mu = FMath::Max(Properties.Stiffness, 0.f);
			Nu = FMath::Clamp(0.5f * (1.f - 2.f * Properties.Incompressiblity), 0.f, 0.5f);
			Size = FMath::Max(BrushRadius * Properties.FallOffDistance, 0.f);
			NumSteps = Properties.BrushSteps;
		}

#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:103

Scope (from outer to inner):

file
function     ULandscapeEditorObject::ULandscapeEditorObject

Source code excerpt:

	, BrushRadius(2048.0f)
    , PaintBrushRadius(2048.0f) 
	, BrushFalloff(0.5f)
	, PaintBrushFalloff(0.5f)
	, bUseClayBrush(false)

	, AlphaBrushScale(0.5f)
	, bAlphaBrushAutoRotate(true)
	, AlphaBrushRotation(0.0f)

#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:218

Scope (from outer to inner):

file
function     void ULandscapeEditorObject::Load

Source code excerpt:

	GConfig->GetFloat(TEXT("LandscapeEdit"), TEXT("PaintBrushRadius"), PaintBrushRadius, GEditorPerProjectIni);
	GConfig->GetInt(TEXT("LandscapeEdit"), TEXT("BrushComponentSize"), BrushComponentSize, GEditorPerProjectIni);
	GConfig->GetFloat(TEXT("LandscapeEdit"), TEXT("BrushFalloff"), BrushFalloff, GEditorPerProjectIni);
	GConfig->GetFloat(TEXT("LandscapeEdit"), TEXT("PaintBrushFalloff"), PaintBrushFalloff, GEditorPerProjectIni);
	bool InbUseClayBrush = bUseClayBrush;
	GConfig->GetBool(TEXT("LandscapeEdit"), TEXT("bUseClayBrush"), InbUseClayBrush, GEditorPerProjectIni);
	bUseClayBrush = InbUseClayBrush;
	GConfig->GetFloat(TEXT("LandscapeEdit"), TEXT("AlphaBrushScale"), AlphaBrushScale, GEditorPerProjectIni);
	GConfig->GetBool(TEXT("LandscapeEdit"), TEXT("AlphaBrushAutoRotate"), bAlphaBrushAutoRotate, GEditorPerProjectIni);

#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:393

Scope (from outer to inner):

file
function     void ULandscapeEditorObject::Save

Source code excerpt:

	GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("PaintBrushRadius"), PaintBrushRadius, GEditorPerProjectIni);
	GConfig->SetInt(TEXT("LandscapeEdit"), TEXT("BrushComponentSize"), BrushComponentSize, GEditorPerProjectIni);
	GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("BrushFalloff"), BrushFalloff, GEditorPerProjectIni);
	GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("PaintBrushFalloff"), PaintBrushFalloff, GEditorPerProjectIni);
	GConfig->SetBool(TEXT("LandscapeEdit"), TEXT("bUseClayBrush"), bUseClayBrush, GEditorPerProjectIni);
	GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("AlphaBrushScale"), AlphaBrushScale, GEditorPerProjectIni);
	GConfig->SetBool(TEXT("LandscapeEdit"), TEXT("AlphaBrushAutoRotate"), bAlphaBrushAutoRotate, GEditorPerProjectIni);
	GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("AlphaBrushRotation"), AlphaBrushRotation, GEditorPerProjectIni);
	GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("AlphaBrushPanU"), AlphaBrushPanU, GEditorPerProjectIni);

#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:1043

Scope (from outer to inner):

file
function     float ULandscapeEditorObject::GetCurrentToolBrushFalloff

Source code excerpt:

		
	}
	return BrushFalloff;
	
}

void ULandscapeEditorObject::SetCurrentToolBrushFalloff(float NewBrushFalloff)
{
	if (IsWeightmapTarget())

#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:1055

Scope (from outer to inner):

file
function     void ULandscapeEditorObject::SetCurrentToolBrushFalloff

Source code excerpt:

	else
	{
		BrushFalloff = NewBrushFalloff;
	}
}

#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Public/LandscapeEditorObject.h:628

Scope (from outer to inner):

file
class        class ULandscapeEditorObject : public UObject

Source code excerpt:

	// The falloff at the edge of the sculpt brush, as a fraction of the brush's size. 0 = no falloff, 1 = all falloff
	UPROPERTY(Category="Brush Settings", EditAnywhere, NonTransactional, meta=(DisplayName="Brush Falloff", ShowForBrushes="BrushSet_Circle,BrushSet_Gizmo,BrushSet_Pattern", ShowForTargetTypes = "Heightmap,Visibility", ClampMin="0", ClampMax="1", UIMin = "0", UIMax = "1"))
	float BrushFalloff;
	
	// The falloff at the edge of the paint brush, as a fraction of the brush's size. 0 = no falloff, 1 = all falloff
	UPROPERTY(Category="Brush Settings", EditAnywhere, NonTransactional, meta=(DisplayName="Brush Falloff", ShowForBrushes="BrushSet_Circle,BrushSet_Gizmo,BrushSet_Pattern", ShowForTargetTypes = "Weightmap", ClampMin="0", ClampMax="1", UIMin = "0", UIMax = "1"))
	float PaintBrushFalloff;

	// Selects the Clay Brush painting mode

#Loc: <Workspace>/Engine/Source/Runtime/InteractiveToolsFramework/Private/BaseGizmos/BrushStampIndicator.cpp:43

Scope (from outer to inner):

file
function     void UBrushStampIndicator::Render

Source code excerpt:

		if (bDrawSecondaryLines)
		{
			Draw.DrawCircle(BrushPosition, BrushNormal, BrushRadius*BrushFalloff, SampleStepCount, SecondaryLineColor, SecondaryLineThickness, bDepthTested);
			Draw.DrawLine(BrushPosition, BrushPosition + BrushRadius * BrushNormal, SecondaryLineColor, SecondaryLineThickness, bDepthTested);
		}

		Draw.EndFrame();
	}
}

#Loc: <Workspace>/Engine/Source/Runtime/InteractiveToolsFramework/Private/BaseGizmos/BrushStampIndicator.cpp:61

Scope (from outer to inner):

file
function     void UBrushStampIndicator::Update

Source code excerpt:

	BrushPosition = Position;
	BrushNormal = Normal;
	BrushFalloff = Falloff;

	if (AttachedComponent != nullptr)
	{
		FTransform Transform = AttachedComponent->GetComponentTransform();

		if (ScaleInitializedComponent != AttachedComponent)

#Loc: <Workspace>/Engine/Source/Runtime/InteractiveToolsFramework/Private/BaseGizmos/BrushStampIndicator.cpp:93

Scope (from outer to inner):

file
function     void UBrushStampIndicator::Update

Source code excerpt:

	BrushPosition = WorldTransform.GetLocation();
	BrushNormal = WorldTransform.GetRotation().GetAxisZ();
	BrushFalloff = Falloff;

	if (AttachedComponent != nullptr)
	{
		FTransform Transform = WorldTransform;

		if (ScaleInitializedComponent != AttachedComponent)

#Loc: <Workspace>/Engine/Source/Runtime/InteractiveToolsFramework/Public/BaseGizmos/BrushStampIndicator.h:57

Scope (from outer to inner):

file
class        class UBrushStampIndicator : public UInteractiveGizmo

Source code excerpt:


	UPROPERTY()
	float BrushFalloff = 0.5f;

	UPROPERTY()
	FVector BrushPosition = FVector::ZeroVector;

	UPROPERTY()
	FVector BrushNormal = FVector(0, 0, 1);;