CustomMaterial
A material that works with custom Metal shader functions.
Declaration
struct CustomMaterialMentioned in
Overview
Custom, or programmable, materials allow you to leverage RealityKit’s existing shader pipeline to render physically based or unlit materials that support custom Metal shader functions. These functions modify how RealityKit renders an entity. Custom materials support two different types of custom Metal shader functions: geometry modifiers and surface shaders.
Use a _surface shader _to calculate or specify all the material attributes that RealityKit uses to render your entity, such as baseColor, normal, and roughness. A geometry modifier can offset the position of an entity’s vertices to change the size and shape of an entity. It can also change other per-vertex data, such as vertex color and UV texture coordinates, which define how RealityKit maps textures on to the model.
For more information on creating custom materials and writing shader functions, see Modifying RealityKit rendering using custom materials.
Topics
Creating custom materials
init(from:geometryModifier:)init(from:surfaceShader:geometryModifier:)init(surfaceShader:geometryModifier:lightingModel:)init(program:)
Setting the core properties
baseColorroughnessmetallicnormalemissiveColorambientOcclusionspecularclearcoatclearcoatRoughnessclearcoatNormal
Controlling opacity
Setting shader properties
Modifying texture coordinates
Culling unnecessary polygons
Setting depth testing properties
Classes
Structures
CustomMaterial.AmbientOcclusionCustomMaterial.BaseColorCustomMaterial.ClearcoatCustomMaterial.ClearcoatNormalCustomMaterial.ClearcoatRoughnessCustomMaterial.CustomCustomMaterial.CustomMaterialTextureCustomMaterial.EmissiveColorCustomMaterial.GeometryModifierCustomMaterial.MetallicCustomMaterial.NormalCustomMaterial.OpacityCustomMaterial.ResourceStorageCustomMaterial.RoughnessCustomMaterial.SpecularCustomMaterial.SurfaceShader
Instance Properties
Type Aliases
CustomMaterial.FaceCullingCustomMaterial.TextureCustomMaterial.TextureCoordinateTransformCustomMaterial.TriangleFillMode
Type Properties
Enumerations
See Also
Shaders
Implementing adjustable materialDisplaying a stereoscopic imageShaderGraphMaterialShaderGraphMaterial.FaceCullingShaderGraphMaterial.TriangleFillModeModifying RealityKit rendering using custom materialsCustomMaterial.SurfaceShaderCustomMaterial.GeometryModifierMaterialFunctionCustomMaterial.ProgramCustomMaterial.Program.DescriptorCustomShaderStage