bEnableRayTracing
bEnableRayTracing
#Overview
name: bEnableRayTracing
The value of this variable can be defined or overridden in .ini config files. 6
.ini config files referencing this setting variable.
It is referenced in 16
C++ source files. Also referenced in 4
C# build files meaning it may affect the build system logic.
#Summary
#Usage in the C++ source code
The purpose of bEnableRayTracing is to control the support for hardware ray tracing features in Unreal Engine 5. This setting is primarily used for the rendering system, specifically for enabling advanced lighting and shadow techniques.
The bEnableRayTracing variable is relied upon by several Unreal Engine subsystems and modules, including:
- The Renderer module
- The GPULightmass plugin
- The MeshModelingToolset plugin
- Various platform-specific target platforms (Windows, Mac, Android)
The value of this variable is typically set in the project settings or in the engine configuration files (e.g., GEngineIni). It can be modified through the Unreal Engine editor interface or programmatically.
This variable interacts with other settings, such as:
- bSupportSkinCacheShaders: Ray tracing requires skin cache to be enabled
- bEnableRayTracingShadows: Controls whether ray-traced shadows are used by default
- bUseHardwareRayTracingForLumen: Determines if hardware ray tracing is used for the Lumen global illumination system
Developers must be aware of the following when using this variable:
- Enabling ray tracing requires compatible hardware and may impact performance.
- It has dependencies on other settings, such as skin cache shaders.
- It may require specific shader models to be supported (e.g., Shader Model 6 on Windows).
Best practices when using this variable include:
- Ensure that the target hardware supports ray tracing before enabling it.
- Consider the performance implications and test thoroughly on target platforms.
- Be aware of the interdependencies with other rendering settings and adjust them accordingly.
- Use it in conjunction with other ray tracing settings for fine-tuned control over the rendering pipeline.
#Usage in the C# source code and build system
The purpose of bEnableRayTracing is to enable or disable runtime ray tracing support in Unreal Engine 5. This setting is crucial for the rendering system, specifically for implementing advanced lighting and reflection effects using ray tracing technology.
This setting variable is relied upon by multiple platform-specific modules within Unreal Engine, including:
- Android target platform
- Linux target platform
- Mac target platform
- Windows target platform
The value of this variable is set in the configuration files for each platform. For example:
- For Android: “/Script/AndroidTargetPlatform.AndroidTargetSettings”
- For Linux: “/Script/LinuxTargetPlatform.LinuxTargetSettings”
- For Mac: “/Script/MacTargetPlatform.MacTargetSettings”
- For Windows: “/Script/WindowsTargetPlatform.WindowsTargetSettings”
The default value for this variable is set to false across all platforms, indicating that ray tracing is disabled by default.
There are no direct interactions with other variables shown in the provided code snippets. However, enabling ray tracing may have implications for other rendering and performance-related settings in the engine.
Developers must be aware of the following when using this variable:
- Enabling ray tracing can significantly impact performance, especially on less powerful hardware.
- Not all platforms or hardware configurations support ray tracing, so thorough testing is required.
- Enabling ray tracing may require additional setup in the project settings and materials to fully utilize the feature.
Best practices when using this variable include:
- Only enable ray tracing when targeting platforms and hardware that support it.
- Provide options in the game settings for users to enable/disable ray tracing features.
- Implement fallback rendering techniques for systems that don’t support ray tracing.
- Carefully balance visual quality improvements against performance costs when using ray tracing.
- Thoroughly test the game with ray tracing enabled on various hardware configurations to ensure compatibility and performance.
As there is no associated variable mentioned in the provided input, I cannot provide information about an additional variable.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:3100, section: [/Script/AndroidRuntimeSettings.AndroidRuntimeSettings]
- INI Section:
/Script/AndroidRuntimeSettings.AndroidRuntimeSettings
- Raw value:
true
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseEngine.ini:3164, section: [/Script/WindowsTargetPlatform.WindowsTargetSettings]
- INI Section:
/Script/WindowsTargetPlatform.WindowsTargetSettings
- Raw value:
true
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseEngine.ini:3169, section: [/Script/LinuxTargetPlatform.LinuxTargetSettings]
- INI Section:
/Script/LinuxTargetPlatform.LinuxTargetSettings
- Raw value:
true
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseEngine.ini:3181, section: [/Script/MacTargetPlatform.MacTargetSettings]
- INI Section:
/Script/MacTargetPlatform.MacTargetSettings
- Raw value:
false
- Is Array:
False
Location: <Workspace>/Engine/Config/Android/BaseAndroidEngine.ini:16, section: [/Script/AndroidTargetPlatform.AndroidTargetSettings]
- INI Section:
/Script/AndroidTargetPlatform.AndroidTargetSettings
- Raw value:
true
- Is Array:
False
Location: <Workspace>/Engine/Config/Android/DataDrivenPlatformInfo.ini:115, section: [ShaderPlatform VULKAN_SM5_ANDROID]
- INI Section:
ShaderPlatform VULKAN_SM5_ANDROID
- Raw value:
true
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Experimental/GPULightmass/Source/GPULightmassEditor/Private/GPULightmassEditorModule.cpp:68
Scope: file
Source code excerpt:
OK, // Ray tracing is supported and running
DISABLED_BY_PROJECT_SETTINGS, // "Ray Tracing" or "Support Compute Skin Cache" is off in project settings
DISABLED_BY_TARGET_PLATFORM, // FXXXTargetPlatform::UsesRayTracing() returns false (eg. WindowsTargetPlatform checks for bEnableRayTracing in its ini)
INCOMPATIBLE_SHADER_PLATFORM, // An incompatible shader platform is chosen (eg. ES3.1)
INCAPABLE_RHI, // The RHI is incapable of ray tracing in general (eg. DX11)
INCOMPATIBLE_PLUGIN, // An incompatible plugin is enabled (specifically, RenderDoc)
INCAPABLE_HARDWARE, // The video card isn't capable of hardware ray tracing (too old), or supports only software emulated ray tracing (GTX 10 series)
};
#Loc: <Workspace>/Engine/Plugins/Experimental/MeshModelingToolsetExp/Source/MeshModelingToolsExp/Private/PatternTool.cpp:1788
Scope (from outer to inner):
file
function void UPatternTool::EmitResults
lambda-function
Source code excerpt:
NewMeshObjectParams.bEnableCollision = ModelingSettings->bEnableCollision;
NewMeshObjectParams.CollisionMode = ModelingSettings->CollisionMode;
NewMeshObjectParams.bEnableRaytracingSupport = ModelingSettings->bEnableRayTracing;
FCreateMeshObjectResult Result = UE::Modeling::CreateMeshObject(GetToolManager(), MoveTemp(NewMeshObjectParams));
return Result;
};
#Loc: <Workspace>/Engine/Plugins/Runtime/MeshModelingToolset/Source/ModelingComponents/Private/ModelingComponentsSettings.cpp:39
Scope (from outer to inner):
file
function void UModelingComponentsSettings::ApplyDefaultsToCreateMeshObjectParams
Source code excerpt:
Params.CollisionMode = Settings->CollisionMode;
Params.bGenerateLightmapUVs = Settings->bGenerateLightmapUVs;
Params.bEnableRaytracingSupport = Settings->bEnableRayTracing;
}
}
#undef LOCTEXT_NAMESPACE
#Loc: <Workspace>/Engine/Plugins/Runtime/MeshModelingToolset/Source/ModelingComponents/Public/ModelingComponentsSettings.h:46
Scope (from outer to inner):
file
class class UModelingComponentsSettings : public UDeveloperSettings
Source code excerpt:
/** Enable Raytracing Support for new Mesh Objects created by Modeling Tools, if support is optional (eg DynamicMeshActors) */
UPROPERTY(config, EditAnywhere, Category = "Modeling Tools|New Mesh Objects")
bool bEnableRayTracing = false;
/** Enable auto-generated Lightmap UVs for new Mesh Objects created by Modeling Tools, where supported */
UPROPERTY(config, EditAnywhere, Category = "Modeling Tools|New Mesh Objects")
bool bGenerateLightmapUVs = false;
/** Enable Collision Support for new Mesh Objects created by Modeling Tools */
#Loc: <Workspace>/Engine/Source/Developer/Android/AndroidTargetPlatformSettings/Public/AndroidTargetPlatformSettings.h:113
Scope (from outer to inner):
file
class class FAndroidTargetPlatformSettings : public TTargetPlatformSettingsBase<FAndroidPlatformProperties>
function virtual bool UsesRayTracing
Source code excerpt:
virtual bool UsesRayTracing() const override
{
bool bEnableRayTracing = false;
GConfig->GetBool(TEXT("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings"), TEXT("bEnableRayTracing"), bEnableRayTracing, GEngineIni);
return bEnableRayTracing;
}
#if WITH_ENGINE
virtual void GetReflectionCaptureFormats(TArray<FName>& OutFormats) const override;
virtual const UTextureLODSettings& GetTextureLODSettings() const override;
virtual void RegisterTextureLODSettings(const UTextureLODSettings* InTextureLODSettings) override
#Loc: <Workspace>/Engine/Source/Developer/Mac/MacTargetPlatform/Public/GenericMacTargetPlatform.h:229
Scope (from outer to inner):
file
class class TGenericMacTargetPlatform : public TTargetPlatformBase<FMacPlatformProperties<HAS_EDITOR_DATA, IS_DEDICATED_SERVER, IS_CLIENT_ONLY> >
function virtual bool UsesRayTracing
Source code excerpt:
virtual bool UsesRayTracing() const override
{
bool bEnableRayTracing = false;
GConfig->GetBool(TEXT("/Script/MacTargetPlatform.MacTargetSettings"), TEXT("bEnableRayTracing"), bEnableRayTracing, GEngineIni);
return bEnableRayTracing;
}
//~ End ITargetPlatform Interface
private:
// Holds the local device.
#Loc: <Workspace>/Engine/Source/Developer/Windows/WindowsTargetPlatform/Public/GenericWindowsTargetPlatform.h:386
Scope (from outer to inner):
file
class class TGenericWindowsTargetPlatform : public TTargetPlatformBase<TProperties>
function virtual bool UsesRayTracing
Source code excerpt:
virtual bool UsesRayTracing() const override
{
bool bEnableRayTracing = false;
GConfig->GetBool(TEXT("/Script/WindowsTargetPlatform.WindowsTargetSettings"), TEXT("bEnableRayTracing"), bEnableRayTracing, GEngineIni);
return bEnableRayTracing && TSuper::UsesRayTracing();
}
//~ End ITargetPlatform Interface
private:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/RendererSettings.h:537
Scope (from outer to inner):
file
class class URendererSettings : public UDeveloperSettings
Source code excerpt:
ToolTip = "Support Hardware Ray Tracing features. Requires 'Support Compute Skincache' before project is allowed to set this.",
ConfigRestartRequired = true))
uint32 bEnableRayTracing : 1;
UPROPERTY(config, EditAnywhere, Category = HardwareRayTracing, meta = (
ConsoleVariable = "r.RayTracing.Shadows", DisplayName = "Ray Traced Shadows",
ToolTip = "Controls whether Ray Traced Shadows are used by default. Lights can still override and force Ray Traced shadows on or off. Requires Hardware Ray Tracing to be enabled."))
uint32 bEnableRayTracingShadows : 1;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/RendererSettings.cpp:86
Scope (from outer to inner):
file
function URendererSettings::URendererSettings
Source code excerpt:
GPUSimulationTextureSizeX = 1024;
GPUSimulationTextureSizeY = 1024;
bEnableRayTracing = 0;
bUseHardwareRayTracingForLumen = 0;
bEnableRayTracingShadows = 0;
bEnablePathTracing = 0;
bEnableRayTracingTextureLOD = 0;
DefaultBoneInfluenceLimit = 0;
MaxSkinBones = FGPUBaseSkinVertexFactory::GHardwareMaxGPUSkinBones;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/RendererSettings.cpp:179
Scope (from outer to inner):
file
function void URendererSettings::PostEditChangeProperty
Source code excerpt:
}
if (PropertyChangedEvent.Property->GetFName() == GET_MEMBER_NAME_CHECKED(URendererSettings, bEnableRayTracing)
&& bEnableRayTracing
&& !bSupportSkinCacheShaders)
{
FString FullPath = FPaths::ConvertRelativePathToFull(GetDefaultConfigFilename());
FPlatformFileManager::Get().GetPlatformFile().SetReadOnly(*FullPath, false);
if (FMessageDialog::Open(EAppMsgType::YesNo, LOCTEXT("Skin Cache Disabled", "Ray Tracing requires enabling skin cache. Do you want to automatically enable skin cache now?")) == EAppReturnType::Yes)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/RendererSettings.cpp:193
Scope (from outer to inner):
file
function void URendererSettings::PostEditChangeProperty
Source code excerpt:
else
{
bEnableRayTracing = 0;
UpdateDependentPropertyInConfigFile(this, GET_MEMBER_NAME_CHECKED(URendererSettings, bEnableRayTracing));
}
}
if (PropertyChangedEvent.Property->GetFName() == GET_MEMBER_NAME_CHECKED(URendererSettings, bSupportSkinCacheShaders)
&& !bSupportSkinCacheShaders
&& bSkipCompilingGPUSkinVF)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/RendererSettings.cpp:342
Scope (from outer to inner):
file
function bool URendererSettings::CanEditChange
Source code excerpt:
{
//only allow DISABLE of skincache shaders if raytracing is also disabled as skincache is a dependency of raytracing.
return !bSupportSkinCacheShaders || !bEnableRayTracing;
}
// the bSkipCompilingGPUSkinVF setting can only be edited if the skin cache is on.
if ((InProperty->GetFName() == GET_MEMBER_NAME_CHECKED(URendererSettings, bSkipCompilingGPUSkinVF)))
{
return bSupportSkinCacheShaders;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/RendererSettings.cpp:356
Scope (from outer to inner):
file
function bool URendererSettings::CanEditChange
Source code excerpt:
(InProperty->GetFName() == GET_MEMBER_NAME_CHECKED(URendererSettings, bEnableRayTracingTextureLOD)))
{
return bEnableRayTracing;
}
if ((InProperty->GetFName() == GET_MEMBER_NAME_CHECKED(URendererSettings, bSupportSkyAtmosphereAffectsHeightFog)))
{
return bSupportSkyAtmosphere;
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/RendererSettings.cpp:400
Scope (from outer to inner):
file
function void URendererSettings::CheckForMissingShaderModels
Source code excerpt:
#if PLATFORM_WINDOWS || PLATFORM_LINUX
static IConsoleVariable* RayTracingRequireSM6CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.RayTracing.RequireSM6"));
const bool bRayTracingRequireSM6 = bEnableRayTracing && RayTracingRequireSM6CVar && RayTracingRequireSM6CVar->GetBool();
if (GIsEditor && (ShadowMapMethod == EShadowMapMethod::VirtualShadowMaps || bRayTracingRequireSM6))
{
auto CopySM6Format = [](const TCHAR* ShaderFormatName, const TArray<FString>& SrcArray, TArray<FString>& DstArray)
{
if (SrcArray.Contains(ShaderFormatName))
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightRendering.cpp:1333
Scope (from outer to inner):
file
function void FDeferredShadingSceneRenderer::RenderLights
Source code excerpt:
const bool bUseHairLighting = HairStrands::HasViewHairStrandsData(Views);
#if RHI_RAYTRACING
const bool bEnableRayTracing = true;
#else
const bool bEnableRayTracing = false;
#endif // RHI_RAYTRACING
const bool bUseLightFunctionAtlas = LightFunctionAtlas::IsEnabled(*Scene, ELightFunctionAtlasSystem::DeferredLighting);
RDG_EVENT_SCOPE(GraphBuilder, "Lights");
RDG_GPU_STAT_SCOPE(GraphBuilder, Lights);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightRendering.cpp:1513
Scope (from outer to inner):
file
function void FDeferredShadingSceneRenderer::RenderLights
Source code excerpt:
// function was converted to render graph, and want least intrusive change as possible. So right now it trades render target memory pressure
// for denoising perf.
if (bEnableRayTracing && bDoShadowBatching)
{
const uint32 ViewIndex = 0;
FViewInfo& View = Views[ViewIndex];
const int32 NumShadowedLights = ManyLightsLightStart - UnbatchedLightStart;
// Allocate PreprocessedShadowMaskTextures once so QueueTextureExtraction can deferred write.
#References in C# build files
This variable is referenced in the following C# build files:
Location: <Workspace>/Engine/Source/Programs/UnrealBuildTool/Platform/Android/UEBuildAndroid.cs:48
/// </summary>
[ConfigFile(ConfigHierarchyType.Engine, "/Script/AndroidTargetPlatform.AndroidTargetSettings")]
public bool bEnableRayTracing = false;
/// <summary>
/// Enables ASIS plugin and STANDALONE support.
/// </summary>
[ConfigFile(ConfigHierarchyType.Engine, "/Script/AndroidSingleInstanceServiceEditor.AndroidSingleInstanceServiceRuntimeSettings")]
public bool bEnableASISPlugin = false;
Location: <Workspace>/Engine/Source/Programs/UnrealBuildTool/Platform/Linux/UEBuildLinux.cs:106
/// </summary>
[ConfigFile(ConfigHierarchyType.Engine, "/Script/LinuxTargetPlatform.LinuxTargetSettings")]
public bool bEnableRayTracing = false;
}
/// <summary>
/// Read-only wrapper for Linux-specific target settings
/// </summary>
public class ReadOnlyLinuxTargetRules
Location: <Workspace>/Engine/Source/Programs/UnrealBuildTool/Platform/Mac/UEBuildMac.cs:59
/// Enables runtime ray tracing support.
/// </summary>
[ConfigFile(ConfigHierarchyType.Engine, "/Script/MacTargetPlatform.MacTargetSettings", "bEnableRayTracing")]
public bool bEnableRayTracing = false;
}
/// <summary>
/// Read-only wrapper for Mac-specific target settings
/// </summary>
Location: <Workspace>/Engine/Source/Programs/UnrealBuildTool/Platform/Windows/UEBuildWindows.cs:397
/// Enables runtime ray tracing support.
/// </summary>
[ConfigFile(ConfigHierarchyType.Engine, "/Script/WindowsTargetPlatform.WindowsTargetSettings", "bEnableRayTracing")]
public bool bEnableRayTracing = false;
/// <summary>
/// The name of the company (author, provider) that created the project.
/// </summary>
[ConfigFile(ConfigHierarchyType.Game, "/Script/EngineSettings.GeneralProjectSettings", "CompanyName")]