Type Property

fragment

Use this entry point to change the color of a fragment after all other shading has been performed.

Declaration

static let fragment: SCNShaderModifierEntryPoint

Discussion

Shader modifiers for this entry point execute in the fragment processing stage.

The fragment entry point defines the following structure:

struct SCNShaderOutput {
   vec4 color;
} _output;

Your shader modifier reads from this structure and writes a new color to the same structure to produce the final output color for each rendered fragment.

This shader modifier inverts the output color:

_output.color.rgb = vec3(1.0) - _output.color.rgb;

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software