Skip to main content

SkSL Filter

Intro

Write custom filters in SkSL ("Skia Shading Language").

SkSL ("Skia Shading Language") is a variant of GLSL which is used as Skia's internal shading language. With some minor modifications, GLSL code from sites like https://www.shadertoy.com/ can be converted for use in Cavalry.

For more detail on the differences between GLSL and SkSL see the Skia documentation.

Integer Uniforms

The SkSL Filter does not accept integer uniforms, please use floats instead.

UI

Blend Mode - See Blend Modes.

Filter Code - Write/paste/edit SkSL code here.

Inputs - Click the + button to to choose a uniform type and add one. Uniforms can be renamed by right clicking on an attribute and choosing Rename.... This name can then be used as a variable in the Filter Code.

Built in Uniforms

Built in Uniforms can be added to the Filter Code:

  • resolution - the size of the Shape being rendered which can be used to produce Filters that scale to their contents. See the example in Create > Demo Scenes > Custom Shaders and Filters > Emboss Filter.
Examples

See the following examples in Create > Demo Scenes > Custom Shaders and Filters > :

  • Emboss Filter
  • Green Screen Filter
  • Scatter Filter