---
title: CustomMaterial.GeometryModifier
framework: realitykit
role: symbol
role_heading: Structure
path: realitykit/custommaterial/geometrymodifier
---

# CustomMaterial.GeometryModifier

The custom material’s optional shader function that can manipulate an entity’s vertex data.

## Declaration

```swift
struct GeometryModifier
```

## Overview

Overview A geometry modifier is an optional Metal function that you can use with custom materials. Use a geometry modifier to change vertex data, such as vertex position, color, or texture coordinates. For example, offsetting a vertex’s position changes the size and shape of the entity for rendering only. If your custom material has a geometry modifier, RealityKit’s custom material vertex shader calls it once for each vertex in the entity. Changes that your geometry modifier makes are transient and don’t affect the vertex positions of the original ModelEntity. Here’s a simple example of a geometry modifier that offsets the vertex positions along the z-axis based on the elapsed time: #include <metal_stdlib> #include <RealityKit/RealityKit.h> using namespace metal;

[[visible]] void myGeometryModifier(realitykit::geometry_parameters params) {     float3 zOffset = float3(0.0, 0.0, params.uniforms().time() / 50.0);     params.geometry().set_world_position_offset(zOffset); } For more information on creating custom materials and writing shader functions, see Modifying RealityKit rendering using custom materials.

## Topics

### Creating geometry modifier objects

- [init(named:in:)](realitykit/custommaterial/geometrymodifier/init(named:in:).md)

### Accessing geometry modifier properties

- [name](realitykit/custommaterial/geometrymodifier/name.md)
- [library](realitykit/custommaterial/geometrymodifier/library.md)

### Initializers

- [init(named:in:constantValues:)](realitykit/custommaterial/geometrymodifier/init(named:in:constantvalues:).md)

## Relationships

### Conforms To

- [Equatable](swift/equatable.md)
- [Escapable](swift/escapable.md)
- [Hashable](swift/hashable.md)
- [MaterialFunction](realitykit/materialfunction.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Shaders

- [Implementing adjustable material](visionos/implementing-adjustable-material-in-visionos.md)
- [Displaying a stereoscopic image](visionos/displaying-a-stereoscopic-image-in-visionos.md)
- [ShaderGraphMaterial](realitykit/shadergraphmaterial.md)
- [ShaderGraphMaterial.FaceCulling](realitykit/shadergraphmaterial/faceculling-swift.typealias.md)
- [ShaderGraphMaterial.TriangleFillMode](realitykit/shadergraphmaterial/trianglefillmode-swift.typealias.md)
- [Modifying RealityKit rendering using custom materials](realitykit/modifying-realitykit-rendering-using-custom-materials.md)
- [CustomMaterial](realitykit/custommaterial.md)
- [CustomMaterial.SurfaceShader](realitykit/custommaterial/surfaceshader.md)
- [MaterialFunction](realitykit/materialfunction.md)
- [CustomMaterial.Program](realitykit/custommaterial/program-swift.class.md)
- [CustomMaterial.Program.Descriptor](realitykit/custommaterial/program-swift.class/descriptor-swift.struct.md)
- [CustomShaderStage](realitykit/customshaderstage.md)
