# 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)

*** ** * ** ***


```
public final class ImageBasedLightingAsset implements 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/androidx/xr/scenecore/SpatialEnvironment`.

## Summary

| ### Public methods |
|---|---|
| `void` | `@https://developer.android.com/reference/androidx/annotation/MainThread https://developer.android.com/reference/androidx/xr/scenecore/ImageBasedLightingAsset#close()()` Closes the given `https://developer.android.com/reference/androidx/xr/scenecore/ImageBasedLightingAsset`. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/ImageBasedLightingAsset` | `@https://developer.android.com/reference/androidx/annotation/MainThread https://developer.android.com/reference/androidx/xr/scenecore/ImageBasedLightingAsset#createFromZip(androidx.xr.runtime.Session,java.nio.file.Path)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/Session session, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/nio/file/Path.html path)` Public factory for an `https://developer.android.com/reference/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. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/ImageBasedLightingAsset` | `@https://developer.android.com/reference/androidx/annotation/MainThread https://developer.android.com/reference/androidx/xr/scenecore/ImageBasedLightingAsset#createFromZip(androidx.xr.runtime.Session,android.net.Uri)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/Session session, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html uri)` Public factory for an `https://developer.android.com/reference/androidx/xr/scenecore/ImageBasedLightingAsset`, asynchronously loading a preprocessed image based lighting asset from a `https://developer.android.com/reference/android/net/Uri.html`. |
| `boolean` | `https://developer.android.com/reference/androidx/xr/scenecore/ImageBasedLightingAsset#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `int` | `https://developer.android.com/reference/androidx/xr/scenecore/ImageBasedLightingAsset#hashCode()()` |

## Public methods

### close

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

```
@MainThread
public void close()
```

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

The `https://developer.android.com/reference/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/androidx/xr/scenecore/ImageBasedLightingAsset` will be automatically closed when the `https://developer.android.com/reference/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. |

### createFromZip

```
@MainThread
public static final @NonNull ImageBasedLightingAsset createFromZip(@NonNull Session session, @NonNull Path path)
```

Public factory for an `https://developer.android.com/reference/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 |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/Session session` | The `https://developer.android.com/reference/androidx/xr/runtime/Session` to use for loading the asset. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/nio/file/Path.html path` | 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/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/ImageBasedLightingAsset` | a `https://developer.android.com/reference/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
public static final @NonNull ImageBasedLightingAsset createFromZip(@NonNull Session session, @NonNull Uri uri)
```

Public factory for an `https://developer.android.com/reference/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 |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/Session session` | The `https://developer.android.com/reference/androidx/xr/runtime/Session` to use for loading the asset. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html uri` | The Uri of the preprocessed `.zip` image based lighting asset file to be loaded. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/ImageBasedLightingAsset` | a `https://developer.android.com/reference/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. |

### equals

```
public boolean equals(Object other)
```

### hashCode

```
public int hashCode()
```