ReflectionProbe
Captures its surroundings to create fast, accurate reflections from a given point.
ReflectionProbe.swift:26class ReflectionProbe
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 .updateOnce). ReflectionProbe
s can be blended together and with the rest of the scene smoothly. ReflectionProbe
s can also be combined with VoxelGI
, SDFGI (sdfgiEnabled
) and screen-space reflections (ssrEnabled
) to get more accurate reflections in specific areas. ReflectionProbe
s 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.
Superclasses
class VisualInstance3D
Parent of all visual 3D nodes.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Types
Type members
Instance members
var ambientColor: Color
The custom ambient color to use within the
ReflectionProbe
’s box defined by itssize
. Only effective ifambientMode
is .ambientColor.var ambientColorEnergy: Double
The custom ambient color energy to use within the
ReflectionProbe
’s box defined by itssize
. Only effective ifambientMode
is .ambientColor.var ambientMode: ReflectionProbe.AmbientMode
The ambient color to use within the
ReflectionProbe
’s box defined by itssize
. The ambient color will smoothly blend with otherReflectionProbe
s and the rest of the scene (outside theReflectionProbe
’s box defined by itssize
).var boxProjection: Bool
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.var cullMask: UInt32
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. It is best to only include large objects which are likely to take up a lot of space in the reflection in order to save on rendering cost.var enableShadows: Bool
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 .updateAlwaysupdateMode
.var intensity: Double
Defines the reflection intensity. Intensity modulates the strength of the reflection.
var interior: Bool
If
true
, reflections will ignore sky contribution.var maxDistance: Double
The maximum distance away from the
ReflectionProbe
an object can be before it is culled. Decrease this to improve performance, especially when using the .updateAlwaysupdateMode
.var meshLodThreshold: Double
The automatic LOD bias to use for meshes rendered within the
ReflectionProbe
(this is analog tomeshLodThreshold
). Higher values will use less detailed versions of meshes that have LOD variations generated. If set to0.0
, automatic LOD is disabled. IncreasemeshLodThreshold
to improve performance at the cost of geometry detail, especially when using the .updateAlwaysupdateMode
.var originOffset: Vector3
Sets the origin offset to be used when this
ReflectionProbe
is inboxProjection
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.var reflectionMask: UInt32
Sets the reflection mask which determines what objects have reflections applied from this probe. Every
VisualInstance3D
with a layer included in this reflection mask will have reflections applied from this probe. See alsocullMask
, which can be used to exclude objects from appearing in the reflection while still making them affected by theReflectionProbe
.var size: Vector3
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.
var updateMode: ReflectionProbe.UpdateMode
Sets how frequently the
ReflectionProbe
is updated. Can be .updateOnce or .updateAlways.