Skip to main content

@luma.gl/shaders/plugins

@luma.gl/shaders/plugins offers a small catalog of predefined shader plugins.

Pass the exported ShaderPlugin descriptors to the @luma.gl/engine Model class through its plugins array prop. When using ShaderAssembler directly, call resolveShaderPlugins() for the target shader language and pass the resolved contributions to the assembler.

import {clipPlugin, filterPlugin} from '@luma.gl/shaders/plugins';
PluginWhat the host suppliesWhat the descriptor adds
filterPluginFILTER_POSITION vertex shader target. filterValues scalar column, with one value tested per row.Declares the vertex input and injects a range check that moves rejected vertices outside clip space.
clipPluginCLIP_POSITION vertex target and CLIP_COLOR fragment target.Injects clipping at both targets and carries clipCoordinates from vertex to fragment for per-pixel clipping.