<!--
{
  "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/TextureResource",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation15TextureResourceC"
  },
  "title" : "TextureResource"
}
-->

# TextureResource

A representation of a texture.

```
@MainActor @preconcurrency class TextureResource
```

## Overview

A texture resource holds pixel data accessible by the GPU,
organized as an image, a cube of images, an array of images, or a 3D image
(volume texture).

Assign texture resources to material parameters to provide color and fine
surface-rendering details.

## Topics

### Creating a texture resource

[`Contents`](/documentation/RealityKit/TextureResource/Contents)

An object that references the pixel data for each mipmap level of a texture.

[`Format`](/documentation/RealityKit/TextureResource/Format)

The pixel format and encoding of a texture.

[`Compression`](/documentation/RealityKit/TextureResource/Compression)

The compression to apply when importing an image as a texture.

### Creating a 2D texture resource

[`Dimensions2D`](/documentation/RealityKit/TextureResource/Dimensions2D)

The dimensions of a 2D texture.

### Creating a cube texture resource

[`DimensionsCube`](/documentation/RealityKit/TextureResource/DimensionsCube)

The dimensions of the cube texture.

### Creating a 2D array texture resource

[`Dimensions2DArray`](/documentation/RealityKit/TextureResource/Dimensions2DArray)

The dimensions of the 2D array texture.

### Creating a 3D texture resource

[`Dimensions3D`](/documentation/RealityKit/TextureResource/Dimensions3D)

The dimensions of the 3D texture.

### Loading a texture

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

Asynchronously loads a texture resource from a bundle.

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

Asynchronously loads a texture resource from a bundle with options.

[`init(contentsOf:withName:options:)`](/documentation/RealityKit/TextureResource/init(contentsOf:withName:options:))

Asynchronously creates a texture resource from a file URL with creation options.

[`init(contentsOf:withName:)`](/documentation/RealityKit/TextureResource/init(contentsOf:withName:))

Asynchronously creates a texture resource from a file URL.

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

Returns a texture resource by synchronously loading it from a bundle.

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

Returns a texture resource by synchronously loading it from a bundle with options.

[`load(contentsOf:withName:options:)`](/documentation/RealityKit/TextureResource/load(contentsOf:withName:options:))

Synchronously loads a texture resource from a URL with options.

[`load(contentsOf:withName:)`](/documentation/RealityKit/TextureResource/load(contentsOf:withName:))

Synchronously loads a texture resource from a URL.

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

Returns a load request that creates a texture resource by asynchronously loading it from a bundle.

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

Returns a load request that creates a texture resource by asynchronously loading it from a bundle with options.

[`loadAsync(contentsOf:withName:)`](/documentation/RealityKit/TextureResource/loadAsync(contentsOf:withName:))

Asynchronously loads a texture resource from a URL.

### Describing the texture

[`textureType`](/documentation/RealityKit/TextureResource/textureType)

The dimension and arrangement of the texture image data.

[`pixelFormat`](/documentation/RealityKit/TextureResource/pixelFormat)

The texture’s pixel format.

[`height`](/documentation/RealityKit/TextureResource/height)

The height of the texture image, in pixels.

[`width`](/documentation/RealityKit/TextureResource/width)

The width of the texture image, in pixels.

[`depth`](/documentation/RealityKit/TextureResource/depth)

The depth of the texture image, in pixels.

[`arrayLength`](/documentation/RealityKit/TextureResource/arrayLength)

The number of slices in the texture array.

[`mipmapLevelCount`](/documentation/RealityKit/TextureResource/mipmapLevelCount)

The number of mipmaps for the texture.

[`semantic`](/documentation/RealityKit/TextureResource/semantic-swift.property)

The intended usage of the texture resource.

### Drawing the texture

[`drawableQueue`](/documentation/RealityKit/TextureResource/drawableQueue-swift.property)

The drawable queue that replaces the texture.

### Copying the texture

[`copy(to:)`](/documentation/RealityKit/TextureResource/copy(to:)-jfbi)

Copies texture data to another texture.

[`copyAsync(to:completionHandler:)`](/documentation/RealityKit/TextureResource/copyAsync(to:completionHandler:))

Asynchronously copies texture data to another texture.

### Modifying the texture

[`replace(withDrawables:)`](/documentation/RealityKit/TextureResource/replace(withDrawables:))

Dynamically replaces the texture with a drawable queue.

[`replace(withImage:options:)`](/documentation/RealityKit/TextureResource/replace(withImage:options:))

Dynamically replaces the texture with a Core Graphics image.

[`replace(using:options:)`](/documentation/RealityKit/TextureResource/replace(using:options:))

Asynchronously replaces the texture with a Core Graphics image.

[`replace(with:)`](/documentation/RealityKit/TextureResource/replace(with:))

Replaces a texture resource with a low-level texture.

### Deprecated

[`generate(from:withName:options:)`](/documentation/RealityKit/TextureResource/generate(from:withName:options:))

Synchronously creates a texture resource from an in-memory Core Graphics image.

[`generateAsync(from:withName:options:)`](/documentation/RealityKit/TextureResource/generateAsync(from:withName:options:))

Asynchronously generates a texture resource from an in-memory Core
Graphics image.

[`replaceAsync(withImage:options:)`](/documentation/RealityKit/TextureResource/replaceAsync(withImage:options:))

Asynchronously replaces the texture with a Core Graphics image.

[`generate(from:named:options:)`](/documentation/RealityKit/TextureResource/generate(from:named:options:))

Asynchronously generates a texture resource from an in-memory Core
Graphics image.

[`loadAsync(contentsOf:withName:options:)`](/documentation/RealityKit/TextureResource/loadAsync(contentsOf:withName:options:))

Asynchronously loads a texture resource from a URL with options.

## Relationships

### Conforms To

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Equatable`](/documentation/Swift/Equatable)

[`Resource`](/documentation/RealityKit/Resource)

[`Sendable`](/documentation/Swift/Sendable)

---

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)