r.Velocity.EnableLandscapeGrass

r.Velocity.EnableLandscapeGrass

#Overview

name: r.Velocity.EnableLandscapeGrass

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 r.Velocity.EnableLandscapeGrass is to control whether velocity output is enabled for grass components in landscape rendering, specifically for World Position Offset (WPO) calculations.

This setting variable is primarily used in the Foliage module of Unreal Engine, as evidenced by its reference in the GrassInstancedStaticMeshComponent.cpp file. It’s part of the rendering system, particularly affecting how grass instances are rendered and animated on landscapes.

The value of this variable is set through a console variable (CVar) named CVarEnableGrassInstancedWPOVelocity. It’s initialized with a default value of true, meaning velocity output for grass components is enabled by default.

The associated variable CVarEnableGrassInstancedWPOVelocity directly interacts with r.Velocity.EnableLandscapeGrass. They share the same value and purpose.

Developers must be aware that this variable affects the performance and visual quality of grass rendering in landscapes. Enabling it allows for more accurate motion of grass instances, but may have performance implications.

Best practices when using this variable include:

  1. Consider disabling it if performance is a critical issue and the visual quality impact is acceptable.
  2. Test the visual impact of enabling/disabling this feature in different landscape scenarios.
  3. Be aware that changing this setting may affect other systems that rely on grass velocity data.

Regarding the associated variable CVarEnableGrassInstancedWPOVelocity:

The purpose of CVarEnableGrassInstancedWPOVelocity is the same as r.Velocity.EnableLandscapeGrass - to control velocity output for grass components in World Position Offset calculations.

It’s used in the Foliage module, specifically in the UGrassInstancedStaticMeshComponent class.

The value is set when the CVar is initialized, but can be changed at runtime through console commands.

This variable directly affects the behavior of the SupportsWorldPositionOffsetVelocity() function in UGrassInstancedStaticMeshComponent.

Developers should be aware that this variable directly impacts the grass rendering pipeline and may affect performance and visual quality.

Best practices include:

  1. Use this variable in conjunction with profiling tools to find the right balance between performance and visual quality.
  2. Consider exposing this setting in user-facing graphics options if grass quality is a significant factor in your game.
  3. Be cautious when changing this value at runtime, as it may cause visual inconsistencies if not properly managed.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Foliage/Private/GrassInstancedStaticMeshComponent.cpp:5

Scope: file

Source code excerpt:


static TAutoConsoleVariable<bool> CVarEnableGrassInstancedWPOVelocity(
	TEXT("r.Velocity.EnableLandscapeGrass"),
	true,
	TEXT("Specify if you want to output velocity for the grass component for WPO.\n")
	TEXT(" True (default)\n")
	TEXT(" False")
	);

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Foliage/Private/GrassInstancedStaticMeshComponent.cpp:4

Scope: file

Source code excerpt:



static TAutoConsoleVariable<bool> CVarEnableGrassInstancedWPOVelocity(
	TEXT("r.Velocity.EnableLandscapeGrass"),
	true,
	TEXT("Specify if you want to output velocity for the grass component for WPO.\n")
	TEXT(" True (default)\n")
	TEXT(" False")
	);

#Loc: <Workspace>/Engine/Source/Runtime/Foliage/Private/GrassInstancedStaticMeshComponent.cpp:14

Scope (from outer to inner):

file
function     bool UGrassInstancedStaticMeshComponent::SupportsWorldPositionOffsetVelocity

Source code excerpt:

bool UGrassInstancedStaticMeshComponent::SupportsWorldPositionOffsetVelocity() const 
{ 
	return CVarEnableGrassInstancedWPOVelocity.GetValueOnAnyThread() && Super::SupportsWorldPositionOffsetVelocity();
}