<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/EnvironmentResource",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation19EnvironmentResourceC"
  },
  "title" : "EnvironmentResource"
}
-->

# EnvironmentResource

An environmental resource that contains background and lighting information for a scene.

```
@MainActor @preconcurrency class EnvironmentResource
```

## Overview

RealityKit supports image-based lighting that enables realistic reflections on your scene’s 3D
content. You can define the look of your scene’s background by supplying an environment resource
image that determines the general color of the room, and the location of any spotlights or shadowed areas
within the reflection. RealityKit applies the image’s characteristics to your scene’s reflective content.

![Two screenshots depicting the process of applying an environment resource image to a reflective surface in a RealityKit scene. The first screenshot defines the](images/com.apple.RealityKit/EnvironmentResource~dark@2x.png)

RealityKit checks a bundle for an environment resource by the filename you supply to one of the load functions.

### Create a skybox folder

To add an environment resource to your Xcode project, make a folder with a name that ends in `.skybox` and
place a single image inside.
Ensure that the image is an environment map of equirectangular projection, also
known as a *latitude-longitude projection*.
Drag the folder into the Project navigator.
In the options pane, choose to create a folder reference (not a group), and add the folder to your app’s targets.
At build time, Xcode compiles the image for use as an environment resource and inserts the result into the app bundle.

RealityKit supports the same input formats as Image I/O, such as `.png` and `.jpg`
However, to achieve rich, vibrant lighting, use a `.exr` or `.hdr` format, which support a wide dynamic range.

## Topics

### Loading the resource

[`init(named:in:)`](/documentation/RealityKit/EnvironmentResource/init(named:in:))

Asynchronously loads an environment resource from a bundle.

[`init(equirectangular:withName:)`](/documentation/RealityKit/EnvironmentResource/init(equirectangular:withName:)-8o2v7)

Asynchronously generates an environment resource from an equirectangular image.

[`init(equirectangular:withName:)`](/documentation/RealityKit/EnvironmentResource/init(equirectangular:withName:)-8o2v7)

Asynchronously generates an environment resource from an equirectangular image.

[`init(cube:options:)`](/documentation/RealityKit/EnvironmentResource/init(cube:options:)-9j9rn)

Asynchronously creates an environment resource from a cube texture.

[`init(cube:options:)`](/documentation/RealityKit/EnvironmentResource/init(cube:options:)-9j9rn)

Asynchronously creates an environment resource from a cube texture.

[`load(named:in:)`](/documentation/RealityKit/EnvironmentResource/load(named:in:))

Synchronously loads an environment resource from a bundle.

### Configuring the resource creation

[`EnvironmentResource.CreateOptions`](/documentation/RealityKit/EnvironmentResource/CreateOptions)

A type that controls compression, sampling quality, and cubemap dimensions when creating an environment resource.

[`EnvironmentResource.Compression`](/documentation/RealityKit/EnvironmentResource/Compression)

The compression to apply when creating an environment resource.

### Accessing resource data

[`skybox`](/documentation/RealityKit/EnvironmentResource/skybox)

The cube color texture that contains environment surrounding details, or a low-resolution proxy
of the original skybox if the `EnvironmentResource` was created with `CreateOptions(skyboxMode: .discard)`.

### Deprecated

[`generate(fromEquirectangular:withName:)`](/documentation/RealityKit/EnvironmentResource/generate(fromEquirectangular:withName:)-3wtpe)

Synchronously generates an environment resource from an equirectangular image.

[`generate(fromEquirectangular:withName:)`](/documentation/RealityKit/EnvironmentResource/generate(fromEquirectangular:withName:)-6mxsi)

Asynchronously generates an environment resource from an equirectangular image.

[`loadAsync(named:in:)`](/documentation/RealityKit/EnvironmentResource/loadAsync(named:in:))

Asynchronously loads an environment resource from a bundle.

### Creating an environment resource

[`init(named:in:skyboxMode:)`](/documentation/RealityKit/EnvironmentResource/init(named:in:skyboxMode:))

Asynchronously loads an environment resource from a bundle.

[`EnvironmentResource.SkyboxMode`](/documentation/RealityKit/EnvironmentResource/SkyboxMode)

An enumeration controlling how to preserve the skybox.

[`init(equirectangular:options:)`](/documentation/RealityKit/EnvironmentResource/init(equirectangular:options:)-8e7wv)

Asynchronously generates an environment resource from an equirectangular image.

[`init(equirectangular:options:)`](/documentation/RealityKit/EnvironmentResource/init(equirectangular:options:)-5bxl3)

Synchronously creates an environment resource from an equirectangular image.

[`init(skybox:specular:diffuse:)`](/documentation/RealityKit/EnvironmentResource/init(skybox:specular:diffuse:))

Creates an EnvironmentResource a skybox, specular and diffuse texture resources.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)