---
title: "generateDiffuse(using:fromSkyboxCube:quality:into:)"
framework: realitykit
role: symbol
role_heading: Instance Method
platforms: [iOS 27.0+, iPadOS 27.0+, tvOS 27.0+, visionOS 27.0+]
path: "realitykit/imagebasedlighttexturegenerator/generatediffuse(using:fromskyboxcube:quality:into:)"
---

# generateDiffuse(using:fromSkyboxCube:quality:into:)

Adds commands for generating an image based light diffuse texture from a skybox cube.

## Declaration

```swift
func generateDiffuse(using commandBuffer: any MTLCommandBuffer, fromSkyboxCube texture: any MTLTexture, quality: TextureSamplingQuality = .low, into destination: any MTLTexture) throws
```

## Parameters

- `commandBuffer`: The command buffer to dispatch GPU work to generate Image Based Light Diffuse
- `texture`: The source image cube skybox texture, which must have mipmaps.
- `quality`: The sampling quality the method applies as it generates the cube texture.
- `destination`: The destination cube texture. Use doc://com.apple.RealityKit/documentation/RealityKit/ImageBasedLightTextureGenerator/makeDiffuseDescriptor(fromCube:) to get a recommended descriptor for creating the destination texture.

## Discussion

Discussion note: If texture or destination is not a cube texture, or if destination’s pixel format does not support shader writes on this device.

## See Also

### Generating IBL textures

- [generateSpecular(using:fromSkyboxCube:quality:into:)](realitykit/imagebasedlighttexturegenerator/generatespecular(using:fromskyboxcube:quality:into:).md)
