bUseConservativeTexelRasterization

bUseConservativeTexelRasterization

#Overview

name: bUseConservativeTexelRasterization

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

#Summary

#Usage in the C++ source code

The purpose of bUseConservativeTexelRasterization is to control the texel rasterization method in static lighting calculations within Unreal Engine 5. It is specifically used for the static lighting system, which is part of the engine’s rendering and global illumination pipeline.

This setting variable is primarily relied upon by the Lightmass subsystem, which is responsible for precalculating static lighting in Unreal Engine. It’s used in both the editor (UnrealEd) and the standalone Lightmass program.

The value of this variable is set from the configuration file (GLightmassIni) in the Lightmass exporter (FLightmassExporter::WriteSceneSettings). It’s read from the “DevOptions.StaticLighting” section of the config file.

This variable interacts with other lighting-related settings, such as bAccountForTexelSize and bUseMaxWeight, which are often configured alongside it.

Developers must be aware that this setting affects the precision and performance of static lighting calculations. When enabled (set to true), it uses a more conservative approach to texel rasterization, which can potentially improve the quality of lighting but may increase computation time.

Best practices when using this variable include:

  1. Enable it (set to true) when higher quality static lighting is required, especially for scenes with complex geometry or detailed textures.
  2. Consider disabling it for faster iteration times during development, and only enabling it for final lighting builds.
  3. Test the impact on both quality and performance for your specific scenes, as the optimal setting may vary depending on the project’s requirements.
  4. Use it in conjunction with other lighting settings to achieve the best balance between quality and performance.
  5. Document the chosen setting in your project’s lighting guidelines to ensure consistency across the development team.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseLightmass.ini:19, section: [DevOptions.StaticLighting]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Lightmass/Lightmass.cpp:2127

Scope (from outer to inner):

file
function     void FLightmassExporter::WriteSceneSettings

Source code excerpt:


		VERIFYLIGHTMASSINI(GConfig->GetInt(TEXT("DevOptions.StaticLighting"), TEXT("ViewSingleBounceNumber"), Scene.GeneralSettings.ViewSingleBounceNumber, GLightmassIni));
		VERIFYLIGHTMASSINI(GConfig->GetBool(TEXT("DevOptions.StaticLighting"), TEXT("bUseConservativeTexelRasterization"), bConfigBool, GLightmassIni));
		Scene.GeneralSettings.bUseConservativeTexelRasterization = bConfigBool;
		VERIFYLIGHTMASSINI(GConfig->GetBool(TEXT("DevOptions.StaticLighting"), TEXT("bAccountForTexelSize"), bConfigBool, GLightmassIni));
		Scene.GeneralSettings.bAccountForTexelSize = bConfigBool;
		VERIFYLIGHTMASSINI(GConfig->GetBool(TEXT("DevOptions.StaticLighting"), TEXT("bUseMaxWeight"), bConfigBool, GLightmassIni));
		Scene.GeneralSettings.bUseMaxWeight = bConfigBool;
		VERIFYLIGHTMASSINI(GConfig->GetInt(TEXT("DevOptions.StaticLighting"), TEXT("MaxTriangleLightingSamples"), Scene.GeneralSettings.MaxTriangleLightingSamples, GLightmassIni));
		VERIFYLIGHTMASSINI(GConfig->GetInt(TEXT("DevOptions.StaticLighting"), TEXT("MaxTriangleIrradiancePhotonCacheSamples"), Scene.GeneralSettings.MaxTriangleIrradiancePhotonCacheSamples, GLightmassIni));

#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Private/Lighting/TextureMapping.cpp:1101

Scope (from outer to inner):

file
namespace    Lightmass
function     void FStaticLightingSystem::SetupTextureMapping

Source code excerpt:


	// Rasterize the triangles into the texel to vertex map.
	if (GeneralSettings.bUseConservativeTexelRasterization && TextureMapping->bBilinearFilter == true)
	{
		// Using conservative rasterization, which uses super sampling to try to detect all texels that should be mapped.
		for(int32 TriangleIndex = 0;TriangleIndex < TextureMapping->Mesh->NumTriangles;TriangleIndex++)
		{
			// Query the mesh for the triangle's vertices.
			FStaticLightingInterpolant V0;

#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Public/SceneExport.h:110

Scope (from outer to inner):

file
namespace    Lightmass
class        class FStaticLightingSettings

Source code excerpt:

	 * Otherwise only the center and corner of each texel will be sampled. 
	 */
	bool bUseConservativeTexelRasterization;

	/** Debugging - whether to use the texel size in various calculations in an attempt to compensate for point sampling a texel. */
	bool bAccountForTexelSize;

	/** Debugging - whether to use the sample with the largest weight when rasterizing texels or a linear combination. */
	bool bUseMaxWeight;