BakeQualityLevel

BakeQualityLevel

#Overview

name: BakeQualityLevel

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

#Summary

#Usage in the C++ source code

The purpose of BakeQualityLevel is to specify the quality level to use when baking a Niagara simulation. It is part of the Niagara visual effects system in Unreal Engine 5, specifically used in the baking process for Niagara effects.

This setting variable is primarily used within the Niagara plugin, which is part of the FX module in Unreal Engine. The main subsystems that rely on this variable are the Niagara baker and the Niagara quality settings system.

The value of this variable is set in the UNiagaraBakerSettings class, which is likely configurable through the Unreal Engine editor interface. It can be modified programmatically as seen in the SetBakeQualityLevel function of the FNiagaraBakerViewModel class.

BakeQualityLevel interacts with the QualityLevels array from the UNiagaraSettings class. When a non-default quality level is specified, the system overrides the current Niagara quality level for the duration of the baking process.

Developers must be aware that:

  1. Setting BakeQualityLevel to None means the current quality level will be used.
  2. The specified quality level temporarily overrides the global Niagara quality setting during baking.
  3. The quality level affects the performance and visual fidelity of the baked simulation.

Best practices when using this variable include:

  1. Choose an appropriate quality level that balances visual quality and baking performance.
  2. Consider using a higher quality level for final production bakes and a lower one for iterative testing.
  3. Ensure the specified quality level exists in the UNiagaraSettings’ QualityLevels array.
  4. Remember to reset any quality level overrides after the baking process, which is handled automatically in the provided code.
  5. Use the provided setter function (SetBakeQualityLevel) to modify this value, as it ensures proper transaction handling and modification flags are set.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Plugins/FX/Niagara/Config/BaseNiagara.ini:48, section: [/Script/Niagara.NiagaraBakerSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Classes/NiagaraBakerSettings.h:193

Scope (from outer to inner):

file
class        class UNiagaraBakerSettings : public UObject

Source code excerpt:

	/** What quality level to use when baking the simulation, where None means use the current quality level. */
	UPROPERTY(EditAnywhere, Category = "Settings", config)
	FName BakeQualityLevel;

	/** Should we render just the component or the whole scene. */
	UPROPERTY(EditAnywhere, Category = "Settings")
	uint8 bRenderComponentOnly : 1;

	NIAGARA_API bool Equals(const UNiagaraBakerSettings& Other) const;

#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/NiagaraEditor/Private/ViewModels/NiagaraBakerViewModel.cpp:350

Scope (from outer to inner):

file
function     bool FNiagaraBakerViewModel::IsBakeQualityLevel

Source code excerpt:

{
	UNiagaraBakerSettings* BakerSettings = GetBakerSettings();
	return BakerSettings ? BakerSettings->BakeQualityLevel == QualityLevel : false;
}

void FNiagaraBakerViewModel::SetBakeQualityLevel(FName QualityLevel)
{
	if (UNiagaraBakerSettings* BakerSettings = GetBakerSettings())
	{
		const FScopedTransaction Transaction(LOCTEXT("BakeQualityLevel", "Set Bake Quality Level"));
		BakerSettings->Modify();
		BakerSettings->BakeQualityLevel = QualityLevel;
	}
}

bool FNiagaraBakerViewModel::IsSimTickRate(int TickRate) const
{
	UNiagaraBakerSettings* BakerSettings = GetBakerSettings();

#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/NiagaraEditor/Private/ViewModels/NiagaraBakerViewModel.cpp:648

Scope (from outer to inner):

file
function     FNiagaraBakerFeedbackContext FNiagaraBakerViewModel::RenderBaker

Source code excerpt:

		SlowTask.MakeDialog();

		if (BakerSettings->BakeQualityLevel.IsNone() == false)
		{
			const UNiagaraSettings* NiagaraSettings = GetDefault<UNiagaraSettings>();
			for (int32 i=0; i < NiagaraSettings->QualityLevels.Num(); ++i)
			{
				if (FName(NiagaraSettings->QualityLevels[i].ToString()) == BakerSettings->BakeQualityLevel)
				{
					FNiagaraPlatformSet::SetNiagaraQualityLevelOverride(i);
					break;
				}
			}
		}

#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/NiagaraEditor/Private/ViewModels/NiagaraBakerViewModel.cpp:679

Scope (from outer to inner):

file
function     FNiagaraBakerFeedbackContext FNiagaraBakerViewModel::RenderBaker

Source code excerpt:

		}

		if (BakerSettings->BakeQualityLevel.IsNone() == false)
		{
			FNiagaraPlatformSet::ClearNiagaraQualityLevelOverride();
		}
	}

	// Ensure we flush everything from the render thread