bPlaceCellsOnOpaqueOnly
bPlaceCellsOnOpaqueOnly
#Overview
name: bPlaceCellsOnOpaqueOnly
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 bPlaceCellsOnOpaqueOnly is to control the placement of visibility cells in Unreal Engine’s precomputed visibility system. This setting is used to optimize memory usage and performance by determining whether visibility cells should be placed only on opaque surfaces or on all surfaces.
This setting variable is primarily used in the precomputed visibility subsystem of Unreal Engine, which is part of the lighting and rendering system. It is referenced in both the editor (UnrealEd) and the Lightmass module, which handles global illumination and visibility calculations.
The value of this variable is set in the Lightmass configuration file (GLightmassIni). It is read from the config file in the FLightmassExporter::WriteSceneSettings function in Lightmass.cpp.
This variable interacts with other precomputed visibility settings, such as bPlaceCellsOnlyAlongCameraTracks, CellSize, and various other parameters that control the behavior of the visibility system.
Developers must be aware that setting this variable to true can save memory, especially in scenes with a lot of translucent or masked geometry, such as foliage-heavy environments. However, it may also affect the accuracy of visibility calculations for non-opaque objects.
Best practices when using this variable include:
- Enable it (set to true) for scenes with many translucent or masked objects to optimize memory usage.
- Consider the trade-off between memory savings and visibility accuracy for non-opaque objects.
- Test the scene with both settings to ensure that enabling this option doesn’t negatively impact the visual quality or performance of your game.
- Use in conjunction with other precomputed visibility settings to fine-tune the balance between performance and visual quality.
- Be cautious when changing this setting in an existing project, as it may require re-baking lighting and visibility data.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseLightmass.ini:107, section: [DevOptions.PrecomputedVisibility]
- INI Section:
DevOptions.PrecomputedVisibility
- Raw value:
True
- Is Array:
False
#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:2277
Scope (from outer to inner):
file
function void FLightmassExporter::WriteSceneSettings
Source code excerpt:
VERIFYLIGHTMASSINI(GConfig->GetBool(TEXT("DevOptions.PrecomputedVisibility"), TEXT("bVisualizePrecomputedVisibility"), bConfigBool, GLightmassIni));
Scene.PrecomputedVisibilitySettings.bVisualizePrecomputedVisibility = bConfigBool;
VERIFYLIGHTMASSINI(GConfig->GetBool(TEXT("DevOptions.PrecomputedVisibility"), TEXT("bPlaceCellsOnOpaqueOnly"), bConfigBool, GLightmassIni));
Scene.PrecomputedVisibilitySettings.bPlaceCellsOnOpaqueOnly = bConfigBool;
Scene.PrecomputedVisibilitySettings.bPlaceCellsOnlyAlongCameraTracks = World->GetWorldSettings()->bPlaceCellsOnlyAlongCameraTracks;
Scene.PrecomputedVisibilitySettings.CellSize = World->GetWorldSettings()->VisibilityCellSize;
VERIFYLIGHTMASSINI(GConfig->GetInt(TEXT("DevOptions.PrecomputedVisibility"), TEXT("NumCellDistributionBuckets"), Scene.PrecomputedVisibilitySettings.NumCellDistributionBuckets, GLightmassIni));
VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.PrecomputedVisibility"), TEXT("PlayAreaHeight"), Scene.PrecomputedVisibilitySettings.PlayAreaHeight, GLightmassIni));
VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.PrecomputedVisibility"), TEXT("MeshBoundsScale"), Scene.PrecomputedVisibilitySettings.MeshBoundsScale, GLightmassIni));
VERIFYLIGHTMASSINI(GConfig->GetInt(TEXT("DevOptions.PrecomputedVisibility"), TEXT("MinMeshSamples"), Scene.PrecomputedVisibilitySettings.MinMeshSamples, GLightmassIni));
#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Private/Lighting/PrecomputedVisibility.cpp:243
Scope (from outer to inner):
file
namespace Lightmass
function void FStaticLightingSystem::SetupPrecomputedVisibility
Source code excerpt:
// Only place cells on opaque surfaces if requested, which can save some memory for foliage maps
if (!PrecomputedVisibilitySettings.bPlaceCellsOnOpaqueOnly || bOpaqueMesh
|| (!CurrentMesh->IsMasked(ElementIndex) && !CurrentMesh->IsTranslucent(ElementIndex)))
{
FVector2f XYPositions[3];
for (int32 VertIndex = 0; VertIndex < 3; VertIndex++)
{
// Transform world space positions from [PrecomputedVisibilityBounds.Origin - PrecomputedVisibilityBounds.BoxExtent, PrecomputedVisibilityBounds.Origin + PrecomputedVisibilityBounds.BoxExtent] into [0,1]
#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Public/SceneExport.h:385
Scope (from outer to inner):
file
namespace Lightmass
class class FPrecomputedVisibilitySettings
Source code excerpt:
/** Whether to only place visibility cells on opaque surfaces. */
bool bPlaceCellsOnOpaqueOnly;
/** Whether to place visibility cells only along camera tracks or to also include shadow casting surfaces. */
bool bPlaceCellsOnlyAlongCameraTracks;
/** World space size of visibility cells in the x and y dimensions. */
float CellSize;