EnvironmentColor
EnvironmentColor
#Overview
name: EnvironmentColor
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 10
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of EnvironmentColor is to define the color of the environment or background in various rendering scenarios within Unreal Engine 5. It is primarily used for lighting and scene preview purposes, as well as in lightmass calculations for static lighting.
This setting variable is utilized by several Unreal Engine subsystems and modules, including:
- Advanced Preview Scene: Used in the editor for asset previews and scene visualization.
- Persona: Part of the animation system for character previews.
- Lightmass: The global illumination and static lighting system.
- Engine: Core functionality for world settings and scene rendering.
The value of this variable is typically set in the following locations:
- In the FPreviewSceneProfile struct within AssetViewerSettings.h
- As a property of the AWorldSettings class in WorldSettings.h
- Through the editor interface for configuring lighting and environment settings
EnvironmentColor often interacts with other variables, such as:
- EnvironmentIntensity: Used to scale the color’s brightness
- bShowEnvironment: Determines whether the environment color or a skybox is used
Developers should be aware of the following when using this variable:
- It affects both editor previews and in-game lighting calculations.
- The color’s impact may vary depending on the rendering pipeline and lighting settings.
- It can influence the overall mood and lighting of a scene significantly.
Best practices for using this variable include:
- Coordinate its value with other lighting settings for a cohesive look.
- Consider its impact on both static and dynamic lighting scenarios.
- Use it in conjunction with EnvironmentIntensity for fine-tuned control.
- Test the color in different lighting conditions to ensure it works well across various scenarios.
- Be mindful of its effect on performance, especially in lightmass calculations.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseLightmass.ini:63, section: [DevOptions.StaticLightingMaterial]
- INI Section:
DevOptions.StaticLightingMaterial
- Raw value:
(R=0.00000,G=0.00000,B=0.00000)
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Editor/AdvancedPreviewScene/Private/AdvancedPreviewScene.cpp:197
Scope (from outer to inner):
file
function FLinearColor FAdvancedPreviewScene::GetBackgroundColor
Source code excerpt:
FLinearColor FAdvancedPreviewScene::GetBackgroundColor() const
{
FLinearColor Color = DefaultSettings->Profiles[CurrentProfileIndex].EnvironmentColor;
return Color * DefaultSettings->Profiles[CurrentProfileIndex].EnvironmentIntensity;
}
float FAdvancedPreviewScene::GetFloorOffset() const
{
return -(float)FloorMeshComponent->GetRelativeTransform().GetLocation().Z;
#Loc: <Workspace>/Engine/Source/Editor/AdvancedPreviewScene/Public/AssetViewerSettings.h:33
Scope (from outer to inner):
file
function FPreviewSceneProfile
Source code excerpt:
RotationSpeed = 2.0f;
EnvironmentIntensity = 1.0f;
EnvironmentColor = FLinearColor(0.2f, 0.2f, 0.2f, 1.0f);
// Set up default cube map texture from editor/engine textures
EnvironmentCubeMap = nullptr;
EnvironmentCubeMapPath = TEXT("/Engine/EditorMaterials/AssetViewer/EpicQuadPanorama_CC+EV1.EpicQuadPanorama_CC+EV1");
bPostProcessingEnabled = true;
DirectionalLightRotation = FRotator(-40.f, -67.5f, 0.f);
}
#Loc: <Workspace>/Engine/Source/Editor/AdvancedPreviewScene/Public/AssetViewerSettings.h:79
Scope: file
Source code excerpt:
/** The environment color, used if Show Environment is false. */
UPROPERTY(EditAnywhere, config, Category = Environment, meta=(EditCondition="!bShowEnvironment"))
FLinearColor EnvironmentColor;
/** The environment intensity (0.0 - 20.0), used if Show Environment is false. */
UPROPERTY(EditAnywhere, config, Category = Lighting, meta = (UIMin = "0.0", UIMax = "20.0", EditCondition="!bShowEnvironment"))
float EnvironmentIntensity;
/** Sets environment cube map used for sky lighting and reflections */
#Loc: <Workspace>/Engine/Source/Editor/Persona/Private/SAnimViewportToolBar.cpp:1249
Scope (from outer to inner):
file
function FSlateColor SAnimViewportToolBar::GetFontColor
Source code excerpt:
else
{
FLinearColor Color = Settings->Profiles[ProfileIndex].EnvironmentColor * Settings->Profiles[ProfileIndex].EnvironmentIntensity;
// see if it's dark, if V is less than 0.2
if (Color.B < 0.3f )
{
FontColor = FLinearColor::White;
}
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Lightmass/Lightmass.cpp:2223
Scope (from outer to inner):
file
function void FLightmassExporter::WriteSceneSettings
Source code excerpt:
VERIFYLIGHTMASSINI(FParse::Value(*DiffuseStr, TEXT("B="), Scene.MaterialSettings.DebugDiffuse.B));
Scene.MaterialSettings.EnvironmentColor = FLinearColor(LevelSettings.EnvironmentColor) * LevelSettings.EnvironmentIntensity;
static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.NormalMapsForStaticLighting"));
Scene.MaterialSettings.bUseNormalMapsForLighting = CVar->GetValueOnGameThread() != 0;
}
{
VERIFYLIGHTMASSINI(GConfig->GetBool(TEXT("DevOptions.MeshAreaLights"), TEXT("bVisualizeMeshAreaLightPrimitives"), bConfigBool, GLightmassIni));
#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Private/Lighting/FinalGather.cpp:220
Scope (from outer to inner):
file
namespace Lightmass
function FLinearColor FStaticLightingSystem::EvaluateEnvironmentLighting
Source code excerpt:
{
// Upper hemisphere only
return IncomingDirection.Z < 0 ? (MaterialSettings.EnvironmentColor / (float)PI) : FLinearColor::Black;
}
void FStaticLightingSystem::EvaluateSkyLighting(const FVector4f& IncomingDirection, float PathSolidAngle, bool bShadowed, bool bForDirectLighting, FLinearColor& OutStaticLighting, FLinearColor& OutStationaryLighting) const
{
for (int32 LightIndex = 0; LightIndex < SkyLights.Num(); LightIndex++)
{
#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Public/SceneExport.h:219
Scope (from outer to inner):
file
namespace Lightmass
Source code excerpt:
/** Debugging - Emissive value assigned to secondary rays which miss all geometry in the scene. */
FLinearColor EnvironmentColor;
};
/** Settings for meshes which emit light from their emissive areas. */
struct FMeshAreaLightSettings
{
/** Whether to draw debug lines showing the corners of mesh area light primitives when a texel has been selected. */
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/GameFramework/WorldSettings.h:103
Scope: file
Source code excerpt:
*/
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category=LightmassGeneral)
FColor EnvironmentColor;
/** Scales EnvironmentColor to allow independent color and brightness controls. */
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category=LightmassGeneral, meta=(UIMin = "0", UIMax = "10"))
float EnvironmentIntensity;
/** Scales the emissive contribution of all materials in the scene. Currently disabled and should be removed with mesh area lights. */
UPROPERTY()
float EmissiveBoost;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/GameFramework/WorldSettings.h:205
Scope (from outer to inner):
file
function FLightmassWorldInfoSettings
Source code excerpt:
, IndirectLightingQuality(1)
, IndirectLightingSmoothness(1)
, EnvironmentColor(ForceInit)
, EnvironmentIntensity(1.0f)
, EmissiveBoost(1.0f)
, DiffuseBoost(1.0f)
, VolumeLightingMethod(VLM_VolumetricLightmap)
, bUseAmbientOcclusion(false)
, bGenerateAmbientOcclusionMaterialMask(false)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/WorldSettings.cpp:688
Scope (from outer to inner):
file
function bool AWorldSettings::CanEditChange
Source code excerpt:
}
if (PropertyName == GET_MEMBER_NAME_STRING_CHECKED(FLightmassWorldInfoSettings, EnvironmentColor))
{
return LightmassSettings.EnvironmentIntensity > 0;
}
}
else if (PropertyName == GET_MEMBER_NAME_STRING_CHECKED(AWorldSettings, bEnableWorldComposition ) ||
PropertyName == GET_MEMBER_NAME_STRING_CHECKED(AWorldSettings, bForceNoPrecomputedLighting ) ||