One Logo Pool Ball
RealityFoundation · IOS API REFERENCE

DirectionalLightComponent.Shadow

struct · iOS 13.0+ · SDK 27.1

struct Shadow

A directional light component that adds shadows to entities that it illuminates

Members (16)

init · iOS 13.0+

init

TypeScript
static initMaximumDistanceDepthBias(maximumDistance?: number, depthBias?: number): DirectionalLightComponent_Shadow
Swift declaration
init(maximumDistance: Float = 5.0, depthBias: Float = 1.0)

Creates a directional light shadow with a maximum distance and depth bias. The `maximumDistance` parameter in this initializer is equivalent to setting ``shadowProjection`` to `.automatic(maximumDistance: maximumDistance)`. - Parameters: - maximumDistance: The maximum distance for the shadow. - depthBias: The depth bias for the shadow.

get · iOS 13.0+ · Deprecated in iOS 18.0

maximumDistance

TypeScript
get maximumDistance(): number
Swift declaration
var maximumDistance: Float { get set }

The maximum distance for the shadow.

set · iOS 13.0+ · Deprecated in iOS 18.0

maximumDistance

TypeScript
set maximumDistance(value: number)
Swift declaration
var maximumDistance: Float { get set }

The maximum distance for the shadow.

get · iOS 18.0+

cullModeOverride

TypeScript
get cullModeOverride(): (MaterialParameterTypes_FaceCulling) | null
Swift declaration
var cullModeOverride: DirectionalLightComponent.Shadow.ShadowMapCullMode? { get set }

The light's culling mode for shadow map rendering.

set · iOS 18.0+

cullModeOverride

TypeScript
set cullModeOverride(value: (MaterialParameterTypes_FaceCulling) | null)
Swift declaration
var cullModeOverride: DirectionalLightComponent.Shadow.ShadowMapCullMode? { get set }

The light's culling mode for shadow map rendering.

init · iOS 18.0+

init

TypeScript
static initShadowProjectionDepthBiasCullMode(shadowProjection: DirectionalLightComponent_Shadow_ShadowProjectionType, depthBias: number, cullMode?: (MaterialParameterTypes_FaceCulling) | null): DirectionalLightComponent_Shadow
Swift declaration
init(shadowProjection: DirectionalLightComponent.Shadow.ShadowProjectionType, depthBias: Float, cullMode: DirectionalLightComponent.Shadow.ShadowMapCullMode? = nil)

Creates a directional light shadow with a shadow projection, depth bias and cull mode. - Parameters: - shadowProjection: The shadow projection used for shadow map rendering. - depthBias: The depth bias for the shadow. - cullMode: The mode used to cull faces when generating the shadow.

get · iOS 18.0+

shadowProjection

TypeScript
get shadowProjection(): DirectionalLightComponent_Shadow_ShadowProjectionType
Swift declaration
var shadowProjection: DirectionalLightComponent.Shadow.ShadowProjectionType { get set }

Sets the shadow projection used for shadow map rendering

set · iOS 18.0+

shadowProjection

TypeScript
set shadowProjection(value: DirectionalLightComponent_Shadow_ShadowProjectionType)
Swift declaration
var shadowProjection: DirectionalLightComponent.Shadow.ShadowProjectionType { get set }

Sets the shadow projection used for shadow map rendering

get · iOS 27.0+

layers

TypeScript
get layers(): (RenderLayer_Set) | null
Swift declaration
var layers: RenderLayer.Set? { get set }

The layers of entities that cast shadows from this light. An entity casts a shadow into this light's shadow map when the layers of its ``RenderLayerComponent`` intersect with this set. Set this property to: - `nil` (the default) to inherit ``DirectionalLightComponent/layers``, so any entity the light illuminates can also cast a shadow from it. - An empty set to disable shadow casting from this light entirely. Shadow casting can be restricted by layer on devices with Apple6 GPU family feature support.

set · iOS 27.0+

layers

TypeScript
set layers(value: (RenderLayer_Set) | null)
Swift declaration
var layers: RenderLayer.Set? { get set }

The layers of entities that cast shadows from this light. An entity casts a shadow into this light's shadow map when the layers of its ``RenderLayerComponent`` intersect with this set. Set this property to: - `nil` (the default) to inherit ``DirectionalLightComponent/layers``, so any entity the light illuminates can also cast a shadow from it. - An empty set to disable shadow casting from this light entirely. Shadow casting can be restricted by layer on devices with Apple6 GPU family feature support.

init · iOS 27.0+

init

TypeScript
static initLayers(layers?: (RenderLayer_Set) | null): DirectionalLightComponent_Shadow
Swift declaration
init(layers: RenderLayer.Set? = nil)

Creates a directional light shadow that accepts shadow casters from the specified layers. - Parameter layers: The layers of entities that cast shadows from this light. Pass `nil` (the default) to inherit ``DirectionalLightComponent/layers``, or an empty set to disable shadow casting entirely.

get · iOS 27.0+

cascades

TypeScript
get cascades(): DirectionalLightComponent_Shadow_Cascades
Swift declaration
var cascades: DirectionalLightComponent.Shadow.Cascades { get set }

Number of shadow cascades to use when rendering shadows for this light. Cascaded shadow maps can significantly increase the shadow resolution of directional lights and help reduce perspective aliasing, particularly effective in expansive scenes with viewing angles displaying both objects close to the viewer and in the far distance. By default, the light uses one cascade which means a single shadow map texture is mapped to the entire area covered by the directional light. The more cascades are used, the higher the effective resolution of the shadows cast by the light. However, note that using two cascades would take up twice as much texture memory in your app, three cascades three times as much, and so on. Note that a light with ``ShadowProjectionType/fixed(zNear:zFar:orthographicScale:)`` shadow projection will not participate in cascaded shadow maps.

set · iOS 27.0+

cascades

TypeScript
set cascades(value: DirectionalLightComponent_Shadow_Cascades)
Swift declaration
var cascades: DirectionalLightComponent.Shadow.Cascades { get set }

Number of shadow cascades to use when rendering shadows for this light. Cascaded shadow maps can significantly increase the shadow resolution of directional lights and help reduce perspective aliasing, particularly effective in expansive scenes with viewing angles displaying both objects close to the viewer and in the far distance. By default, the light uses one cascade which means a single shadow map texture is mapped to the entire area covered by the directional light. The more cascades are used, the higher the effective resolution of the shadows cast by the light. However, note that using two cascades would take up twice as much texture memory in your app, three cascades three times as much, and so on. Note that a light with ``ShadowProjectionType/fixed(zNear:zFar:orthographicScale:)`` shadow projection will not participate in cascaded shadow maps.

get · iOS 13.0+

depthBias

TypeScript
get depthBias(): number
Swift declaration
var depthBias: Float

A constant value that RealityKit applies as a bias to its shadow calculations. Reduce visual effects such as _shadow acne_, by adjusting this property. The default value is `1.0`.

set · iOS 13.0+

depthBias

TypeScript
set depthBias(value: number)
Swift declaration
var depthBias: Float

A constant value that RealityKit applies as a bias to its shadow calculations. Reduce visual effects such as _shadow acne_, by adjusting this property. The default value is `1.0`.

init · iOS 13.0+

init

TypeScript
static init(): DirectionalLightComponent_Shadow
Swift declaration
init()

Creates a directional light shadow using default values.

Skipped declarations

No declarations were skipped in this snapshot.

All RealityFoundation types →