---
title: DirectionalLightComponent
framework: realitykit
role: symbol
role_heading: Structure
path: realitykit/directionallightcomponent
---

# DirectionalLightComponent

A component that defines a directional light source.

## Declaration

```swift
struct DirectionalLightComponent
```

## Mentioned in

Automatically animating RealityKit entities

## Overview

Overview A directional light shines in the entity’s forward direction [0, 0, -1]. Change the a directional light’s direction with the Entity/orientation or look(at:from:upVector:relativeTo:) method of the Entity with a DirectionalLightComponent. The position of the entity does not play a part in the directional light’s effect. tip: Turn on shadows for a directional light by adding the DirectionalLightComponent.Shadow component to an entity that has a DirectionalLightComponent. Use this component with shadows by adding DirectionalLightComponent and DirectionalLightComponent.Shadow to an entity’s components set. In this example, the light’s color is red, and the intensity is 10_000, which is an approximate lux for ambient daylight: let lightEntity = Entity()

let redLightComponent = DirectionalLightComponent(     color: .red, intensity: 10_000 ) let lightShadowComponent = DirectionalLightComponent.Shadow() lightEntity.components.set([redLightComponent, lightShadowComponent]) The directional light illuminates entities evenly in the direction it derives from the orientation of lightEntity. Here is a visual example of how the above code snippet could illuminates entities in a scene:  |   |  note: The green arrows in the above illustration are only a visual representation of the light’s direction.

## Topics

### Creating a directional light

- [init(color:intensity:)](realitykit/directionallightcomponent/init(color:intensity:).md)
- [init(color:intensity:isRealWorldProxy:)](realitykit/directionallightcomponent/init(color:intensity:isrealworldproxy:)-42x82.md)
- [init(color:intensity:isRealWorldProxy:)](realitykit/directionallightcomponent/init(color:intensity:isrealworldproxy:)-42x82.md)

### Setting the color

- [color](realitykit/directionallightcomponent/color-5ebuh.md)
- [color](realitykit/directionallightcomponent/color-5ebuh.md)

### Setting intensity and shadows

- [intensity](realitykit/directionallightcomponent/intensity.md)
- [isRealWorldProxy](realitykit/directionallightcomponent/isrealworldproxy.md)

### Supporting types

- [DirectionalLightComponent.Color](realitykit/directionallightcomponent/color-swift.typealias.md)

### Assigning render layers

- [layers](realitykit/directionallightcomponent/layers.md)

### Structures

- [DirectionalLightComponent.Shadow](realitykit/directionallightcomponent/shadow.md)

### Initializers

- [init(color:intensity:isRealWorldProxy:)](realitykit/directionallightcomponent/init(color:intensity:isrealworldproxy:).md)

### Instance Properties

- [color](realitykit/directionallightcomponent/color-7hs4n.md)

## Relationships

### Conforms To

- [Component](realitykit/component.md)
- [Copyable](swift/copyable.md)
- [Equatable](swift/equatable.md)
- [Escapable](swift/escapable.md)

## See Also

### Directional lights and their shadows

- [DirectionalLightComponent.Shadow](realitykit/directionallightcomponent/shadow.md)
- [DirectionalLightComponent.Shadow.ShadowProjectionType](realitykit/directionallightcomponent/shadow/shadowprojectiontype.md)
- [DirectionalLightComponent.Shadow.ShadowMapCullMode](realitykit/directionallightcomponent/shadow/shadowmapcullmode.md)
