Class

DirectionalLight

An entity that casts a virtual light in a particular direction.

Declaration

class DirectionalLight : Entity

Overview

During an AR session, RealityKit automatically lights your virtual objects to match real-world lighting. You can also explicitly add virtual lights that act upon your virtual content. This is typically most useful outside of an AR session (with the view’s cameraMode property set to ARView.CameraMode.nonAR).

A directional light uniformly casts light along its z-axis—specifically, along (0, 0, -1). Use the light’s look(at:from:upVector:relativeTo:) method to aim the light in a particular direction.

You can configure the light’s color and intensity. You can also control how or if it casts a shadow.

Topics

Creating a Directional Light

init()

Creates a directional light entity.

func clone(recursive: Bool) -> Self

Duplicates a directional light entity to create a new directional light entity.

Identifying a Directional Light

var id: ObjectIdentifier

The stable identity of the entity associated with self.

var id: UInt64

The stable identity of the directional light.

typealias DirectionalLight.ID

A type of unique identifier used for a directional light.

Configuring the Directional Light

var light: DirectionalLightComponent

A directional light component for the entity.

struct DirectionalLightComponent

A component that defines a directional light source.

var shadow: DirectionalLightComponent.Shadow?

The shadow cast by a directional light.

protocol HasDirectionalLight

An interface that defines a directional light source component.

Loading a Stored Entity

Stored Entities

Manage entities stored as assets on disk.

Positioning Entities in Space

Finding the Nearest Anchor

Describing the Light

See Also

Cameras and Lighting

class PerspectiveCamera

A virtual camera that establishes the rendering perspective.

Beta
class PointLight

An entity that produces an omnidirectional light for virtual objects.

Beta
class SpotLight

An entity that illuminates virtual content in a cone-shaped volume.

Beta

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software