# KhronosUnlitMaterial

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/KhronosUnlitMaterial.kt+class:androidx.xr.scenecore.KhronosUnlitMaterial) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

*** ** * ** ***


```
class KhronosUnlitMaterial : Material
```

<br />

*** ** * ** ***

Represents an unlit material, which is not affected by scene lighting.

This material type is defined by a base color and supports a limited set of parameters. It is a direct implementation of the following glTF features:

- [KHR_materials_unlit extension](https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_unlit)

- [baseColorTexture](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#metallic-roughness-material)

- [baseColorFactor](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#metallic-roughness-material)

- [alphaMode (and alphaCutoff)](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#alpha-coverage)

## Summary

| ### Public companion functions |
|---|---|
| `suspend https://developer.android.com/reference/kotlin/androidx/xr/scenecore/KhronosUnlitMaterial` | `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread https://developer.android.com/reference/kotlin/androidx/xr/scenecore/KhronosUnlitMaterial#create(androidx.xr.runtime.Session,androidx.xr.scenecore.AlphaMode)(session: https://developer.android.com/reference/kotlin/androidx/xr/runtime/Session, alphaMode: https://developer.android.com/reference/kotlin/androidx/xr/scenecore/AlphaMode)` Asynchronously creates a `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/KhronosUnlitMaterial`. |

| ### 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/KhronosUnlitMaterial#close()()` Closes the `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/KhronosUnlitMaterial` and releases its underlying graphics resources. |
| `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/KhronosUnlitMaterial#setAlphaCutoff(kotlin.Float)(alphaCutoff: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, to = 1.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Sets the alpha cutoff threshold. |
| `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/KhronosUnlitMaterial#setBaseColorFactor(androidx.xr.runtime.math.Vector4)(factor: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector4)` Sets a linear multiplier for the base color. |
| `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/KhronosUnlitMaterial#setBaseColorTexture(androidx.xr.scenecore.Texture,androidx.xr.scenecore.TextureSampler)(texture: https://developer.android.com/reference/kotlin/androidx/xr/scenecore/Texture, sampler: https://developer.android.com/reference/kotlin/androidx/xr/scenecore/TextureSampler)` Sets the material's base color using a texture. |

## Public companion functions

### create

```
@MainThread
suspend fun create(session: Session, alphaMode: AlphaMode): KhronosUnlitMaterial
```

Asynchronously creates a `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/KhronosUnlitMaterial`.

| Parameters |
|---|---|
| `session: https://developer.android.com/reference/kotlin/androidx/xr/runtime/Session` | The active `https://developer.android.com/reference/kotlin/androidx/xr/runtime/Session` in which to create the material. |
| `alphaMode: https://developer.android.com/reference/kotlin/androidx/xr/scenecore/AlphaMode` | The `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/AlphaMode` to use for the material. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/KhronosUnlitMaterial` | The newly created `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/KhronosUnlitMaterial`. |

## Public functions

### close

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

Closes the `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/KhronosUnlitMaterial` and releases its underlying graphics resources.

After being closed, the `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/KhronosUnlitMaterial` should not be used further.

### setAlphaCutoff

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

```
@MainThread
fun setAlphaCutoff(alphaCutoff: @FloatRange(from = 0.0, to = 1.0) Float): Unit
```

Sets the alpha cutoff threshold.

This value is only used when the material's `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/KhronosUnlitMaterial#alphaMode()` is `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/AlphaMode#MASK()`.

| Parameters |
|---|---|
| `alphaCutoff: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, to = 1.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The alpha cutoff. Fragments with alpha below this value are discarded. Default is 0.5. Valid values are between 0.0 and 1.0, inclusive. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if the material's alphaMode is not ALPHA_MODE_MASK. |

### setBaseColorFactor

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

```
@MainThread
fun setBaseColorFactor(factor: Vector4): Unit
```

Sets a linear multiplier for the base color.

By default this is 1, 1, 1, 1.

| Parameters |
|---|---|
| `factor: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector4` | The `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector4` (RGBA) factor multiplied component-wise with the base color texture. |

### setBaseColorTexture

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

```
@MainThread
fun setBaseColorTexture(
    texture: Texture,
    sampler: TextureSampler = TextureSampler()
): Unit
```

Sets the material's base color using a texture.

By default this is a white texture, where all pixels are 1, 1, 1, 1. In other words, if this is left as default, the base color will always be the base color factor.

| Parameters |
|---|---|
| `texture: https://developer.android.com/reference/kotlin/androidx/xr/scenecore/Texture` | The `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/Texture` to be used as the base color texture, in sRGB color space. |
| `sampler: https://developer.android.com/reference/kotlin/androidx/xr/scenecore/TextureSampler = TextureSampler()` | The `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/TextureSampler` to be used when sampling the base color texture. |