SCNShaderModifierEntryPointFragment

Static SCNShaderModifierEntryPointFragment 

Source
pub unsafe static SCNShaderModifierEntryPointFragment: &'static SCNShaderModifierEntryPoint
Available on crate feature SCNShadable only.
Expand description

This is the last entry point in the fragment shader, where you can alter the final color returned by the shader.

You can alter the final color by reading and writing to the output color via the output structure below.

Structures available from the SCNShaderModifierEntryPointFragment entry point:

| All the structures available from the SCNShaderModifierEntryPointSurface entry point | | Access: ReadOnly | Stages: Fragment shader only

| struct SCNFramebuffer { | float4 color; // Contents of the destination framebuffer corresponding to the fragment being processed | } _framebuffer; // Available since macOS 13, iOS 16, tvOS 16 and watchOS 9. | | Access: ReadOnly | Stages: Fragment shader only

| struct SCNShaderOutput { | float4 color; | } _output; | | Access: ReadWrite | Stages: Fragment shader only

Example: Inverse final color

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

Metal Shading Language | _output.color.rgb = 1.0 - _output.color.rgb;

See also Apple’s documentation