blotter

ChannelSplitMaterial

The ChannelSplitMaterial takes the Red, Green, and Blue values of the pixels that construct your text, and splits them so that they spread in different directions away from their original position. You've likely seen similar effects to this in the real world in places such as old CRT monitors, damaged VHS tapes, or in the visible color distortion fringing at the edges of a projector's light against a wall.

ChannelSplitMaterial extends Material, and therefore has the same properties and functions as Material.

  • construction

    import { ChannelSplitMaterial } from "blotter.ts/materials";
    
    const material = new ChannelSplitMaterial();
  • uniforms material.uniforms

    An object that holds the uniforms that describe how the material's effects should be rendered. Each entry is a live UniformInterface: assign to its value and the running effect updates. You should not replace this property directly.

    • uOffset material.uniforms.uOffset

      The uOffset uniform is used to describe the distance apart that your RGB values should spread. For this effect, the Green values stay in their original position, while the Red and the Blue values spread in opposite directions away from one another along the axis described by the uRotation uniform.

      • value material.uniforms.uOffset.value

        A floating point value between 0.0 (0%) and 1.0 (100%), relative to the height of your text (including any padding and line height).

        Note that for performance reasons regarding the blurring done with this effect, there is an internal 200 pixel maximum that this value is clamped to. This means that if, for example, the value for the uOffset uniform were to be 1.0 on a text with a total height of 400 pixels, the effect will render as if the value were 0.5.

        The default value is 0.05.

      • type material.uniforms.uOffset.type

        The uniform type of the value being passed to the shader. "1f" means the value is a single float (e.g. 0.5). You should not change this property.

    • uRotation material.uniforms.uRotation

      The uRotation uniform describes the angle, in degrees, upon which channel splitting should occur.

      • value material.uniforms.uRotation.value

        A floating point value between 0.0 and 360.0.

        The default value is 45.

      • type material.uniforms.uRotation.type

        The uniform type of the value being passed to the shader. "1f" means the value is a single float (e.g. 0.5). You should not change this property.

    • uApplyBlur material.uniforms.uApplyBlur

      The uApplyBlur uniform serves as a boolean (true/false) value, meant to tell the effect whether or not to blur the splitting of RGB values along the axis determined by the uRotation uniform. When true, a motion blur will be applied across the distance described by the uOffset uniform, softening the separation of channels, and creating a more ghostly effect.

      • value material.uniforms.uApplyBlur.value

        A floating point value. Either 0.0 (false) or 1.0 (true).

        The default value is 1.

      • type material.uniforms.uApplyBlur.type

        The uniform type of the value being passed to the shader. "1f" means the value is a single float (e.g. 0.5). You should not change this property.

    • uAnimateNoise material.uniforms.uAnimateNoise

      When blurring is applied to your text, as determined by the uApplyBlur uniform, ChannelSplitMaterial will apply a subtle amount of noise distortion to the sampled RGB channels. This is both for performance and aesthetic reasons. The uAnimateNoise uniform serves as a boolean (true/false) value, meant to tell the effect whether or not to animate this noise. When true, the speckling of the noise will animate to create a more static-like effect.

      • value material.uniforms.uAnimateNoise.value

        A floating point value. Either 0.0 (false) or 1.0 (true).

        The default value is 1.

      • type material.uniforms.uAnimateNoise.type

        The uniform type of the value being passed to the shader. "1f" means the value is a single float (e.g. 0.5). You should not change this property.

source code