Class ReflectionProbe
- Namespace
- Godot
- Assembly
- GodotSharp.dll
Captures its surroundings as a cubemap, and stores versions of it with increasing levels of blur to simulate different material roughnesses.
The ReflectionProbe is used to create high-quality reflections at a low performance cost (when UpdateMode is Once). ReflectionProbes can be blended together and with the rest of the scene smoothly. ReflectionProbes can also be combined with VoxelGI, SDFGI (SdfgiEnabled) and screen-space reflections (SsrEnabled) to get more accurate reflections in specific areas. ReflectionProbes render all objects within their CullMask, so updating them can be quite expensive. It is best to update them once with the important static objects and then leave them as-is.
Note: Unlike VoxelGI and SDFGI, ReflectionProbes only source their environment from a WorldEnvironment node. If you specify an Environment resource within a Camera3D node, it will be ignored by the ReflectionProbe. This can lead to incorrect lighting within the ReflectionProbe.
Note: Reflection probes are only supported in the Forward+ and Mobile rendering methods, not Compatibility. When using the Mobile rendering method, only 8 reflection probes can be displayed on each mesh resource. Attempting to display more than 8 reflection probes on a single mesh resource will result in reflection probes flickering in and out as the camera moves.
Note: When using the Mobile rendering method, reflection probes will only correctly affect meshes whose visibility AABB intersects with the reflection probe's AABB. If using a shader to deform the mesh in a way that makes it go outside its AABB, ExtraCullMargin must be increased on the mesh. Otherwise, the reflection probe may not be visible on the mesh.
public class ReflectionProbe : VisualInstance3D, IDisposable
- Inheritance
-
ReflectionProbe
- Implements
- Inherited Members
Constructors
ReflectionProbe()
public ReflectionProbe()
Properties
AmbientColor
The custom ambient color to use within the ReflectionProbe's box defined by its Size. Only effective if AmbientMode is Color.
public Color AmbientColor { get; set; }
Property Value
AmbientColorEnergy
The custom ambient color energy to use within the ReflectionProbe's box defined by its Size. Only effective if AmbientMode is Color.
public float AmbientColorEnergy { get; set; }
Property Value
AmbientMode
The ambient color to use within the ReflectionProbe's box defined by its Size. The ambient color will smoothly blend with other ReflectionProbes and the rest of the scene (outside the ReflectionProbe's box defined by its Size).
public ReflectionProbe.AmbientModeEnum AmbientMode { get; set; }
Property Value
BoxProjection
If true
, enables box projection. This makes reflections look more correct in rectangle-shaped rooms by offsetting the reflection center depending on the camera's location.
Note: To better fit rectangle-shaped rooms that are not aligned to the grid, you can rotate the ReflectionProbe node.
public bool BoxProjection { get; set; }
Property Value
CullMask
Sets the cull mask which determines what objects are drawn by this probe. Every VisualInstance3D with a layer included in this cull mask will be rendered by the probe. To improve performance, it is best to only include large objects which are likely to take up a lot of space in the reflection.
public uint CullMask { get; set; }
Property Value
EnableShadows
If true
, computes shadows in the reflection probe. This makes the reflection probe slower to render; you may want to disable this if using the AlwaysUpdateMode.
public bool EnableShadows { get; set; }
Property Value
Intensity
Defines the reflection intensity. Intensity modulates the strength of the reflection.
public float Intensity { get; set; }
Property Value
Interior
If true
, reflections will ignore sky contribution.
public bool Interior { get; set; }
Property Value
MaxDistance
The maximum distance away from the ReflectionProbe an object can be before it is culled. Decrease this to improve performance, especially when using the AlwaysUpdateMode.
Note: The maximum reflection distance is always at least equal to the probe's extents. This means that decreasing MaxDistance will not always cull objects from reflections, especially if the reflection probe's box defined by its Size is already large.
public float MaxDistance { get; set; }
Property Value
MeshLodThreshold
The automatic LOD bias to use for meshes rendered within the ReflectionProbe (this is analog to MeshLodThreshold). Higher values will use less detailed versions of meshes that have LOD variations generated. If set to 0.0
, automatic LOD is disabled. Increase MeshLodThreshold to improve performance at the cost of geometry detail, especially when using the AlwaysUpdateMode.
Note: MeshLodThreshold does not affect GeometryInstance3D visibility ranges (also known as "manual" LOD or hierarchical LOD).
public float MeshLodThreshold { get; set; }
Property Value
OriginOffset
Sets the origin offset to be used when this ReflectionProbe is in BoxProjection mode. This can be set to a non-zero value to ensure a reflection fits a rectangle-shaped room, while reducing the number of objects that "get in the way" of the reflection.
public Vector3 OriginOffset { get; set; }
Property Value
Size
The size of the reflection probe. The larger the size, the more space covered by the probe, which will lower the perceived resolution. It is best to keep the size only as large as you need it.
Note: To better fit areas that are not aligned to the grid, you can rotate the ReflectionProbe node.
public Vector3 Size { get; set; }
Property Value
UpdateMode
Sets how frequently the ReflectionProbe is updated. Can be Once or Always.
public ReflectionProbe.UpdateModeEnum UpdateMode { get; set; }
Property Value
Methods
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
method
godot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signal
godot_string_nameName of the signal to check for.
Returns
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
method
godot_string_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.