ShowFlag.TextRender

ShowFlag.TextRender

#Overview

name: ShowFlag.TextRender

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

It is referenced in 7 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of ShowFlag.TextRender is to control the rendering of TextRenderComponents, which are used to display 3D text in Unreal Engine.

This setting variable is primarily used by the rendering system in Unreal Engine. It is referenced in the Engine module, specifically in the scene rendering and component systems.

The value of this variable is set through the engine’s show flags system. It is defined as SHOWFLAG_ALWAYS_ACCESSIBLE, which means it can be toggled on and off at runtime and is always available, even in shipping builds.

The TextRender variable interacts with the EngineShowFlags struct, which is used to control various rendering features. It is also associated with the TextRender component of the ATextRenderActor class.

Developers should be aware that this flag affects the visibility of all TextRenderComponents in the scene. When disabled, 3D text will not be rendered, which can be useful for performance optimization or for hiding text in certain view modes.

Best practices when using this variable include:

  1. Use it to toggle 3D text visibility for debugging or performance testing.
  2. Be cautious when disabling it in shipping builds, as it may hide important in-game text.
  3. Consider its impact on scene capture components, as it’s exposed in SceneCapture.

Regarding the associated variable TextRender:

The purpose of TextRender is to represent the UTextRenderComponent within the ATextRenderActor class. It is the primary component responsible for rendering 3D text in the scene.

This variable is used in the Engine module, specifically in the TextRenderActor and TextRenderComponent classes.

The value of TextRender is set in the constructor of ATextRenderActor, where it’s created as a default subobject.

TextRender interacts with other components like the SpriteComponent in editor builds, and it’s the root component of the ATextRenderActor.

Developers should be aware that TextRender is the key component for displaying 3D text, and its properties will affect how the text appears in the game world.

Best practices for using TextRender include:

  1. Use it to add readable 3D text to your game world.
  2. Adjust its properties (like font, size, color) to ensure text is legible in different lighting conditions.
  3. Consider performance implications when using many TextRenderComponents in a scene.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:305

Scope: file

Source code excerpt:

SHOWFLAG_FIXED_IN_SHIPPING(1, CameraSafeFrames, SFG_Advanced, NSLOCTEXT("UnrealEd", "CameraSafeFramesSF", "Camera Safe Frames"))
/** Render TextRenderComponents (3D text), for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(TextRender, SFG_Advanced, NSLOCTEXT("UnrealEd", "TextRenderSF", "Render (3D) Text"))
/** Any rendering/buffer clearing  (good for benchmarking and for pausing rendering while the app is not in focus to save cycles). */
SHOWFLAG_ALWAYS_ACCESSIBLE(Rendering, SFG_Hidden, NSLOCTEXT("UnrealEd", "RenderingSF", "Any Rendering")) // do not make it FIXED_IN_SHIPPING, used by Oculus plugin.
/** Show the current mask being used by the highres screenshot capture */
SHOWFLAG_FIXED_IN_SHIPPING(0, HighResScreenshotMask, SFG_Transient, NSLOCTEXT("UnrealEd", "HighResScreenshotMaskSF", "High Res Screenshot Mask"))
/** Distortion of output for HMD devices, SHOWFLAG_ALWAYS_ACCESSIBLE for now because USceneCaptureComponent needs that */
SHOWFLAG_ALWAYS_ACCESSIBLE(HMDDistortion, SFG_PostProcess, NSLOCTEXT("UnrealEd", "HMDDistortionSF", "HMD Distortion"))

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/TextRenderActor.h:23

Scope (from outer to inner):

file
class        class ATextRenderActor : public AActor

Source code excerpt:

	/** Component to render a text in 3d with a font */
	UPROPERTY(Category = TextRenderActor, VisibleAnywhere, BlueprintReadOnly, meta = (ExposeFunctionCategories = "Rendering|Components|TextRender", AllowPrivateAccess = "true"))
	TObjectPtr<class UTextRenderComponent> TextRender;

#if WITH_EDITORONLY_DATA
	// Reference to the billboard component
	UPROPERTY()
	TObjectPtr<UBillboardComponent> SpriteComponent;
#endif

public:
	/** Returns TextRender subobject **/
	class UTextRenderComponent* GetTextRender() const { return TextRender; }
#if WITH_EDITORONLY_DATA
	/** Returns SpriteComponent subobject **/
	UBillboardComponent* GetSpriteComponent() const { return SpriteComponent; }
#endif
};

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/TextRenderComponent.cpp:34

Scope (from outer to inner):

file
function     ATextRenderActor::ATextRenderActor

Source code excerpt:

	: Super(ObjectInitializer)
{
	TextRender = CreateDefaultSubobject<UTextRenderComponent>(TEXT("NewTextRenderComponent"));
	RootComponent = TextRender;

#if WITH_EDITORONLY_DATA
	SpriteComponent = CreateEditorOnlyDefaultSubobject<UBillboardComponent>(TEXT("Sprite"));

	if (!IsRunningCommandlet() && (SpriteComponent != nullptr))
	{

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/TextRenderComponent.cpp:55

Scope (from outer to inner):

file
function     ATextRenderActor::ATextRenderActor

Source code excerpt:

		SpriteComponent->Sprite = ConstructorStatics.TextRenderTexture.Get();
		SpriteComponent->SetRelativeScale3D_Direct(FVector(0.5f, 0.5f, 0.5f));
		SpriteComponent->SetupAttachment(TextRender);
		SpriteComponent->bIsScreenSizeScaled = true;
		SpriteComponent->SetUsingAbsoluteScale(true);
		SpriteComponent->bReceivesDecals = false;
	}
#endif
}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/TextRenderComponent.cpp:851

Scope (from outer to inner):

file
function     FPrimitiveViewRelevance FTextRenderSceneProxy::GetViewRelevance

Source code excerpt:

{
	FPrimitiveViewRelevance Result;
	Result.bDrawRelevance = IsShown(View) && View->Family->EngineShowFlags.TextRender;
	Result.bShadowRelevance = IsShadowCast(View);
	Result.bRenderCustomDepth = ShouldRenderCustomDepth();
	Result.bRenderInMainPass = ShouldRenderInMainPass();
	Result.bUsesLightingChannels = GetLightingChannelMask() != GetDefaultLightingChannelMask();
	Result.bTranslucentSelfShadow = bCastVolumetricTranslucentShadow;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShowFlags.cpp:652

Scope (from outer to inner):

file
function     void EngineShowFlagOverride

Source code excerpt:

			 DISABLE_ENGINE_SHOWFLAG(Lighting)
			 DISABLE_ENGINE_SHOWFLAG(Translucency)
			 DISABLE_ENGINE_SHOWFLAG(TextRender)
			 DISABLE_ENGINE_SHOWFLAG(Particles)
			 DISABLE_ENGINE_SHOWFLAG(SkeletalMeshes)
			 DISABLE_ENGINE_SHOWFLAG(StaticMeshes)
			 DISABLE_ENGINE_SHOWFLAG(NaniteMeshes)
			 DISABLE_ENGINE_SHOWFLAG(BSP)
			 DISABLE_ENGINE_SHOWFLAG(Paper2DSprites)

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:305

Scope: file

Source code excerpt:

SHOWFLAG_FIXED_IN_SHIPPING(1, CameraSafeFrames, SFG_Advanced, NSLOCTEXT("UnrealEd", "CameraSafeFramesSF", "Camera Safe Frames"))
/** Render TextRenderComponents (3D text), for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(TextRender, SFG_Advanced, NSLOCTEXT("UnrealEd", "TextRenderSF", "Render (3D) Text"))
/** Any rendering/buffer clearing  (good for benchmarking and for pausing rendering while the app is not in focus to save cycles). */
SHOWFLAG_ALWAYS_ACCESSIBLE(Rendering, SFG_Hidden, NSLOCTEXT("UnrealEd", "RenderingSF", "Any Rendering")) // do not make it FIXED_IN_SHIPPING, used by Oculus plugin.
/** Show the current mask being used by the highres screenshot capture */
SHOWFLAG_FIXED_IN_SHIPPING(0, HighResScreenshotMask, SFG_Transient, NSLOCTEXT("UnrealEd", "HighResScreenshotMaskSF", "High Res Screenshot Mask"))
/** Distortion of output for HMD devices, SHOWFLAG_ALWAYS_ACCESSIBLE for now because USceneCaptureComponent needs that */
SHOWFLAG_ALWAYS_ACCESSIBLE(HMDDistortion, SFG_PostProcess, NSLOCTEXT("UnrealEd", "HMDDistortionSF", "HMD Distortion"))