One Logo Pool Ball
RealityFoundation · IOS API REFERENCE

UnlitMaterial

struct · iOS 13.0+ · SDK 27.1

struct UnlitMaterial

A material that doesn’t respond to lights in the scene. `UnlitMaterial` materials do not respond to virtual or real lighting. Add an `UnlitMaterial` to a model by setting it as one of the ``ModelComponent/materials`` in a ``ModelComponent``. ```swift let unlitMaterial = UnlitMaterial(color: .red) let model = ModelComponent( mesh: .generateBox(size: 1), materials: [unlitMaterial] ) redBoxEntity.components.set(model) ``` For example, a ``SimpleMaterial`` on the left, and an `UnlitMaterial` on the right: | ``SimpleMaterial`` | `UnlitMaterial` | |:-:|:-:| | ![A screenshot of a red cube in a living room scene. The cube is rounded on the edges, and appears to be made of a reflective plastic material.](simplematerial-not-metallic) | ![A screenshot of a red cube in a living room scene. The shape is of a cube observed from an angle above and to the right of it, and has no discernible edges as it has no response to lighting.](unlitmaterial-red) | - Note: The blending mode of `UnlitMaterial` materials should be configured explicitly with the ``UnlitMaterial/blending-swift.property`` property for transparent or translucent surfaces. The `opaque` mode is used when unset.

Members (24)

get · iOS 18.0+

readsDepth

TypeScript
get readsDepth(): boolean
Swift declaration
var readsDepth: Bool { get set }

A boolean value that determines whether this material performs the depth test by reading RealityKit's depth buffer. If true, meshes with this material will depth test each of their fragments when being rendered. If an object that writes depth is in front of this material, this material will be hidden. If false, meshes with this material will ignore the depth test, and always render all of their fragments during their draw call, regardless of the positioning of other objects in the scene. Note that other objects may still render on top of this material, depending on draw order. The default value is true.

set · iOS 18.0+

readsDepth

TypeScript
set readsDepth(value: boolean)
Swift declaration
var readsDepth: Bool { get set }

A boolean value that determines whether this material performs the depth test by reading RealityKit's depth buffer. If true, meshes with this material will depth test each of their fragments when being rendered. If an object that writes depth is in front of this material, this material will be hidden. If false, meshes with this material will ignore the depth test, and always render all of their fragments during their draw call, regardless of the positioning of other objects in the scene. Note that other objects may still render on top of this material, depending on draw order. The default value is true.

get · iOS 18.0+

faceCulling

TypeScript
get faceCulling(): MaterialParameterTypes_FaceCulling
Swift declaration
var faceCulling: UnlitMaterial.FaceCulling { get set }
set · iOS 18.0+

faceCulling

TypeScript
set faceCulling(value: MaterialParameterTypes_FaceCulling)
Swift declaration
var faceCulling: UnlitMaterial.FaceCulling { get set }
get · iOS 18.0+

writesDepth

TypeScript
get writesDepth(): boolean
Swift declaration
var writesDepth: Bool { get set }

A boolean value that determines whether this material writes its depth into RealityKit's depth buffer. If true, meshes with this material will occlude objects behind them by writing their depth into RealityKit's depth buffer. If false, meshes with this material will not write their depth into RealityKit's depth buffer, and may be overwritten by objects drawn behind them, depending on draw order. The default value is true.

set · iOS 18.0+

writesDepth

TypeScript
set writesDepth(value: boolean)
Swift declaration
var writesDepth: Bool { get set }

A boolean value that determines whether this material writes its depth into RealityKit's depth buffer. If true, meshes with this material will occlude objects behind them by writing their depth into RealityKit's depth buffer. If false, meshes with this material will not write their depth into RealityKit's depth buffer, and may be overwritten by objects drawn behind them, depending on draw order. The default value is true.

get · iOS 15.0+

opacityThreshold

TypeScript
get opacityThreshold(): (number) | null
Swift declaration
var opacityThreshold: Float? { get set }

A threshold below which RealityKit ignores opacity. When `opacityThreshold` is set, RealityKit discards pixels with opacity values less than the `opacityThreshold`, and renders opacity values greater than or equal to `opacityThreshold` fully opaque. - Note: When the `opacityThreshold` property is set, the blend mode of the ``UnlitMaterial/blending-swift.property`` property is ignored and the renderer applies the masking behavior.

set · iOS 15.0+

opacityThreshold

TypeScript
set opacityThreshold(value: (number) | null)
Swift declaration
var opacityThreshold: Float? { get set }

A threshold below which RealityKit ignores opacity. When `opacityThreshold` is set, RealityKit discards pixels with opacity values less than the `opacityThreshold`, and renders opacity values greater than or equal to `opacityThreshold` fully opaque. - Note: When the `opacityThreshold` property is set, the blend mode of the ``UnlitMaterial/blending-swift.property`` property is ignored and the renderer applies the masking behavior.

get · iOS 18.0+

triangleFillMode

TypeScript
get triangleFillMode(): MaterialParameterTypes_TriangleFillMode
Swift declaration
var triangleFillMode: UnlitMaterial.TriangleFillMode { get set }

The object that controls how RealityKit draws triangles. A value of ``MaterialParameterTypes/TriangleFillMode/fill`` causes RealityKit to draw triangles normally, while a value of ``MaterialParameterTypes/TriangleFillMode/lines`` turns on wireframe rendering.

set · iOS 18.0+

triangleFillMode

TypeScript
set triangleFillMode(value: MaterialParameterTypes_TriangleFillMode)
Swift declaration
var triangleFillMode: UnlitMaterial.TriangleFillMode { get set }

The object that controls how RealityKit draws triangles. A value of ``MaterialParameterTypes/TriangleFillMode/fill`` causes RealityKit to draw triangles normally, while a value of ``MaterialParameterTypes/TriangleFillMode/lines`` turns on wireframe rendering.

init · iOS 18.0+

init

TypeScript
static initApplyPostProcessToneMap(applyPostProcessToneMap: boolean): UnlitMaterial
Swift declaration
init(applyPostProcessToneMap: Bool)

Creates an UnlitMaterial with the given tone mapping setting

get · iOS 18.0+

textureCoordinateTransform

TypeScript
get textureCoordinateTransform(): MaterialParameterTypes_TextureCoordinateTransform
Swift declaration
var textureCoordinateTransform: UnlitMaterial.TextureCoordinateTransform { get set }

A two-dimensional transformation to apply to the entity’s primary texture coordinates. An entity’s UV texture coordinates control how RealityKit materials map image textures onto an entity. This property allows you to transform the texture coordinates to change the way this material maps its textures. You might, for example, change the scale of a property to apply a tiled, repeating pattern, or continuously rotate or translate the texture coordinates to animate materials to create special effects, such as fire or flowing liquids. The following example shows how to set a material’s UV transformation: ```swift let rotationRadians = Float(45.0) * .pi / 180 // 45 degrees converted to radians. material.textureCoordinateTransform = .init(offset: SIMD2<Float>(x:0.5, y: 0.5), scale: SIMD2<Float>(x:0.5, y: 0.5), rotation: rotationRadians) ``` Some entities imported from USDZ files have more than one set of UV coordinates. This property affects the primary UV set (sometimes called “UV1”). To transform the secondary UV coordinates (”UV2”), use ``UnlitMaterial/secondaryTextureCoordinateTransform``.

set · iOS 18.0+

textureCoordinateTransform

TypeScript
set textureCoordinateTransform(value: MaterialParameterTypes_TextureCoordinateTransform)
Swift declaration
var textureCoordinateTransform: UnlitMaterial.TextureCoordinateTransform { get set }

A two-dimensional transformation to apply to the entity’s primary texture coordinates. An entity’s UV texture coordinates control how RealityKit materials map image textures onto an entity. This property allows you to transform the texture coordinates to change the way this material maps its textures. You might, for example, change the scale of a property to apply a tiled, repeating pattern, or continuously rotate or translate the texture coordinates to animate materials to create special effects, such as fire or flowing liquids. The following example shows how to set a material’s UV transformation: ```swift let rotationRadians = Float(45.0) * .pi / 180 // 45 degrees converted to radians. material.textureCoordinateTransform = .init(offset: SIMD2<Float>(x:0.5, y: 0.5), scale: SIMD2<Float>(x:0.5, y: 0.5), rotation: rotationRadians) ``` Some entities imported from USDZ files have more than one set of UV coordinates. This property affects the primary UV set (sometimes called “UV1”). To transform the secondary UV coordinates (”UV2”), use ``UnlitMaterial/secondaryTextureCoordinateTransform``.

get · iOS 18.0+

secondaryTextureCoordinateTransform

TypeScript
get secondaryTextureCoordinateTransform(): MaterialParameterTypes_TextureCoordinateTransform
Swift declaration
var secondaryTextureCoordinateTransform: UnlitMaterial.TextureCoordinateTransform { get set }

A two-dimensional transformation to apply to the entity’s secondary texture coordinates. This property transforms the secondary set. To transform the primary UV coordinates in a material, see ``UnlitMaterial/textureCoordinateTransform-swift.property``.

set · iOS 18.0+

secondaryTextureCoordinateTransform

TypeScript
set secondaryTextureCoordinateTransform(value: MaterialParameterTypes_TextureCoordinateTransform)
Swift declaration
var secondaryTextureCoordinateTransform: UnlitMaterial.TextureCoordinateTransform { get set }

A two-dimensional transformation to apply to the entity’s secondary texture coordinates. This property transforms the secondary set. To transform the primary UV coordinates in a material, see ``UnlitMaterial/textureCoordinateTransform-swift.property``.

get · iOS 15.0+

color

TypeScript
get color(): PhysicallyBasedMaterial_BaseColor
Swift declaration
var color: UnlitMaterial.BaseColor { get set }

The material's base color. - Note: The blending mode of `UnlitMaterial` materials should be configured explicitly with the ``UnlitMaterial/blending-swift.property`` property for transparent or translucent surfaces. The `opaque` mode is used when unset.

set · iOS 15.0+

color

TypeScript
set color(value: PhysicallyBasedMaterial_BaseColor)
Swift declaration
var color: UnlitMaterial.BaseColor { get set }

The material's base color. - Note: The blending mode of `UnlitMaterial` materials should be configured explicitly with the ``UnlitMaterial/blending-swift.property`` property for transparent or translucent surfaces. The `opaque` mode is used when unset.

init · iOS 18.0+

init

TypeScript
static initProgram(program: UnlitMaterial_Program): UnlitMaterial
Swift declaration
init(program: UnlitMaterial.Program)
get · iOS 18.0+

program

TypeScript
get program(): UnlitMaterial_Program
Swift declaration
var program: UnlitMaterial.Program { get set }
set · iOS 18.0+

program

TypeScript
set program(value: UnlitMaterial_Program)
Swift declaration
var program: UnlitMaterial.Program { get set }
init · iOS 18.0+

init

TypeScript
static initTexture(texture: TextureResource): UnlitMaterial
Swift declaration
init(texture: TextureResource)

Creates a new unlit material with the provided color texture.

get · iOS 15.0+

blending

TypeScript
get blending(): PhysicallyBasedMaterial_Blending
Swift declaration
var blending: UnlitMaterial.Blending { get set }

The transparency options for the material.

set · iOS 15.0+

blending

TypeScript
set blending(value: PhysicallyBasedMaterial_Blending)
Swift declaration
var blending: UnlitMaterial.Blending { get set }

The transparency options for the material.

init · iOS 13.0+

init

TypeScript
static init(): UnlitMaterial
Swift declaration
init()

Creates an unlit material.

Skipped declarations

No declarations were skipped in this snapshot.

All RealityFoundation types →