Use this entry point to modify the surface properties of a material before lighting is computed.
Mac Catalyst 13.0+
Shader modifiers for this entry point execute in the fragment processing stage.
The surface entry point defines the following structure:
Your shader modifier reads from this structure and writes new values to the same structure to alter the surface properties of each rendered fragment. After your shader modifier completes, SceneKit’s shader program uses these properties to compute lighting.
Geometric fields (such as position and normal) are expressed in view space. You can use SceneKit’s uniforms (such as u_inverseViewTransform) to operate in a different coordinate space, but you must convert back to view space before writing results.
Other fields of type vec4 are colors provided by the contents of the corresponding SCNMaterialProperty object. Texture coordinate fields contain values transformed by the relevant material property’s contentsTransform transformation.
The below shader modifier produces black and white stripes on a surface: