One Logo Pool Ball
RealityFoundation · IOS API REFERENCE

SimpleMaterial

struct · iOS 13.0+ · SDK 27.1

struct SimpleMaterial

A basic material that responds to lights in the scene. `SimpleMaterial` responds to both real and virtual lighting to enhance realism. Add a `SimpleMaterial` to a model by setting it as one of the ``ModelComponent/materials`` in a ``ModelComponent``. ```swift let simpleMaterial = SimpleMaterial( color: .red, isMetallic: false ) let model = ModelComponent( mesh: .generateBox(size: 1), materials: [simpleMaterial] ) redBoxEntity.components.set(model) ``` For example, a red `SimpleMaterial` that is not metallic, and one that is metallic: | Not metallic | Metallic | |:-:|:-:| | ![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 cube is rounded on the edges and appears to be made of a reflective metal material.](simplematerial-metallic) |

Members (15)

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: SimpleMaterial.FaceCulling { get set }

A process in which the system specifies polygons to remove before rendering a mesh using this material. To improve performance, RealityKit culls polygons, or faces, that it determines won’t be visible. Discarding faces that aren’t part of the final render eliminates the need to do any calculations for those faces. RealityKit recognizes when a face aims toward the camera (a front face) or away from the camera (a back face). This value controls the type of faces RealityKit culls. This value defaults to ``MaterialParameterTypes/FaceCulling/back``, which means RealityKit removes faces that point away from the camera. Most of the time, this is the correct behavior, because back faces are usually obscured by other front-facing polygons. You can change the culling behavior to cull front faces instead or to turn off face culling altogether, but be aware that turning off face culling results in less efficient rendering and may negatively impact your app’s frame rate.

set · iOS 18.0+

faceCulling

TypeScript
set faceCulling(value: MaterialParameterTypes_FaceCulling)
Swift declaration
var faceCulling: SimpleMaterial.FaceCulling { get set }

A process in which the system specifies polygons to remove before rendering a mesh using this material. To improve performance, RealityKit culls polygons, or faces, that it determines won’t be visible. Discarding faces that aren’t part of the final render eliminates the need to do any calculations for those faces. RealityKit recognizes when a face aims toward the camera (a front face) or away from the camera (a back face). This value controls the type of faces RealityKit culls. This value defaults to ``MaterialParameterTypes/FaceCulling/back``, which means RealityKit removes faces that point away from the camera. Most of the time, this is the correct behavior, because back faces are usually obscured by other front-facing polygons. You can change the culling behavior to cull front faces instead or to turn off face culling altogether, but be aware that turning off face culling results in less efficient rendering and may negatively impact your app’s frame rate.

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 18.0+

triangleFillMode

TypeScript
get triangleFillMode(): MaterialParameterTypes_TriangleFillMode
Swift declaration
var triangleFillMode: SimpleMaterial.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: SimpleMaterial.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.

get · iOS 15.0+

color

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

The material’s color.

set · iOS 15.0+

color

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

The material’s color.

get · iOS 13.0+

metallic

TypeScript
get metallic(): MaterialScalarParameter
Swift declaration
var metallic: MaterialScalarParameter { get set }

A value that you set to control whether the material has a metallic look. This property defines whether a material is dielectric (`0.0`) or a metallic (`1.0`). Although this property can be set to any value between `0` and `1`, to create a realistic material, set it to either `0` or `1`.). - term Dielectric materials: These are materials that simulate real-world materials that are poor conductors. In these materials, light travels into the surface of the material and the color is mostly controlled by the color of the sub-surface. Typical examples of dielectric materaisl include organic materials, plastics, and industrial minerals such as sand, limestone, marble, clay and salt. - term Metallic: A metallic (or *conductive*) material reflects light differently than dielectric ones. The overall color is caused by an immediate re-emission of the light from the entity's surface. Typical examples of metallic materials include aluminum, chassis metal, chromium, copper, gold, silver, and titanium

set · iOS 13.0+

metallic

TypeScript
set metallic(value: MaterialScalarParameter)
Swift declaration
var metallic: MaterialScalarParameter { get set }

A value that you set to control whether the material has a metallic look. This property defines whether a material is dielectric (`0.0`) or a metallic (`1.0`). Although this property can be set to any value between `0` and `1`, to create a realistic material, set it to either `0` or `1`.). - term Dielectric materials: These are materials that simulate real-world materials that are poor conductors. In these materials, light travels into the surface of the material and the color is mostly controlled by the color of the sub-surface. Typical examples of dielectric materaisl include organic materials, plastics, and industrial minerals such as sand, limestone, marble, clay and salt. - term Metallic: A metallic (or *conductive*) material reflects light differently than dielectric ones. The overall color is caused by an immediate re-emission of the light from the entity's surface. Typical examples of metallic materials include aluminum, chassis metal, chromium, copper, gold, silver, and titanium

get · iOS 13.0+

roughness

TypeScript
get roughness(): MaterialScalarParameter
Swift declaration
var roughness: MaterialScalarParameter { get set }

The roughness of the material.

set · iOS 13.0+

roughness

TypeScript
set roughness(value: MaterialScalarParameter)
Swift declaration
var roughness: MaterialScalarParameter { get set }

The roughness of the material.

init · iOS 13.0+

init

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

Creates a simple material.

Skipped declarations

No declarations were skipped in this snapshot.

All RealityFoundation types →