# ImageBasedLightingAsset

Artifact: [androidx.xr.scenecore:scenecore](https://developer.android.com/jetpack/androidx/releases/xr-scenecore) [View Source](https://cs.android.com/search?q=file:androidx/xr/scenecore/ImageBasedLightingAsset.kt+class:androidx.xr.scenecore.ImageBasedLightingAsset) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

*** ** * ** ***


```
class ImageBasedLightingAsset : AutoCloseable
```

<br />

*** ** * ** ***

Represents an image based lighting asset which contains lighting information for the scene.

EXR and HDR images are supported by the `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/SpatialEnvironment`.

## Summary

| ### Public companion functions |
|---|---|
| `suspend https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ImageBasedLightingAsset` | `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ImageBasedLightingAsset#createFromZip(androidx.xr.runtime.Session,java.nio.file.Path)(session: https://developer.android.com/reference/kotlin/androidx/xr/runtime/Session, path: https://developer.android.com/reference/java/nio/file/Path.html)` Public factory for an `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ImageBasedLightingAsset`, asynchronously loading a preprocessed image based lighting asset from a `https://developer.android.com/reference/java/nio/file/Path.html` relative to the application's `assets/` folder. |
| `suspend https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ImageBasedLightingAsset` | `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ImageBasedLightingAsset#createFromZip(androidx.xr.runtime.Session,android.net.Uri)(session: https://developer.android.com/reference/kotlin/androidx/xr/runtime/Session, uri: https://developer.android.com/reference/android/net/Uri.html)` Public factory for an `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ImageBasedLightingAsset`, asynchronously loading a preprocessed image based lighting asset from a `https://developer.android.com/reference/android/net/Uri.html`. |

| ### Public functions |
|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ImageBasedLightingAsset#close()()` Closes the given `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ImageBasedLightingAsset`. |
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ImageBasedLightingAsset#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ImageBasedLightingAsset#hashCode()()` |

## Public companion functions

### createFromZip

```
@MainThread
suspend fun createFromZip(session: Session, path: Path): ImageBasedLightingAsset
```

Public factory for an `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ImageBasedLightingAsset`, asynchronously loading a preprocessed image based lighting asset from a `https://developer.android.com/reference/java/nio/file/Path.html` relative to the application's `assets/` folder.

The input `.zip` file should contain the preprocessed image-based lighting (IBL) data, typically generated from an `.exr` or `.hdr` environment map using a tool like Filament's `cmgen`. See: https://github.com/google/filament/tree/main/tools/cmgen

| Parameters |
|---|---|
| `session: https://developer.android.com/reference/kotlin/androidx/xr/runtime/Session` | The `https://developer.android.com/reference/kotlin/androidx/xr/runtime/Session` to use for loading the asset. |
| `path: https://developer.android.com/reference/java/nio/file/Path.html` | The Path of the preprocessed `.zip` image based lighting asset file to be loaded, relative to the application's `assets/` folder. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ImageBasedLightingAsset` | a `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ImageBasedLightingAsset` upon completion. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `https://developer.android.com/reference/java/nio/file/Path.html#isAbsolute()` is true, as this method requires a relative path, or if the path does not specify a `.zip` file. |

### createFromZip

```
@MainThread
suspend fun createFromZip(session: Session, uri: Uri): ImageBasedLightingAsset
```

Public factory for an `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ImageBasedLightingAsset`, asynchronously loading a preprocessed image based lighting asset from a `https://developer.android.com/reference/android/net/Uri.html`.

The input `.zip` file should contain the preprocessed image-based lighting (IBL) data, typically generated from an `.exr` or `.hdr` environment map using a tool like Filament's `cmgen`. See: https://github.com/google/filament/tree/main/tools/cmgen

| Parameters |
|---|---|
| `session: https://developer.android.com/reference/kotlin/androidx/xr/runtime/Session` | The `https://developer.android.com/reference/kotlin/androidx/xr/runtime/Session` to use for loading the asset. |
| `uri: https://developer.android.com/reference/android/net/Uri.html` | The Uri of the preprocessed `.zip` image based lighting asset file to be loaded. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ImageBasedLightingAsset` | a `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ImageBasedLightingAsset` upon completion. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if the Uri does not specify a `.zip` file. |

## Public functions

### close

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

```
@MainThread
open fun close(): Unit
```

Closes the given `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ImageBasedLightingAsset`.

The `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ImageBasedLightingAsset` can be explicitly closed at any time or garbage collected. When either happens, its resources are freed. If close() is not explicitly invoked by the client, the `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ImageBasedLightingAsset` will be automatically closed when the `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ImageBasedLightingAsset` is garbage collected.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | if the resource has already been closed. |

### equals

```
open operator fun equals(other: Any?): Boolean
```

### hashCode

```
open fun hashCode(): Int
```