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.uniformsAn object that holds the uniforms that describe how the material's effects should be rendered. Each entry is a live
UniformInterface: assign to itsvalueand the running effect updates. You should not replace this property directly.-
uOffset
material.uniforms.uOffsetThe
uOffsetuniform 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 theuRotationuniform.-
value
material.uniforms.uOffset.valueA floating point value between
0.0(0%) and1.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
uOffsetuniform were to be1.0on a text with a total height of 400 pixels, the effect will render as if the value were0.5.The default value is
0.05. -
type
material.uniforms.uOffset.typeThe 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.uRotationThe
uRotationuniform describes the angle, in degrees, upon which channel splitting should occur.-
value
material.uniforms.uRotation.valueA floating point value between
0.0and360.0.The default value is
45. -
type
material.uniforms.uRotation.typeThe 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.uApplyBlurThe
uApplyBluruniform 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 theuRotationuniform. When true, a motion blur will be applied across the distance described by theuOffsetuniform, softening the separation of channels, and creating a more ghostly effect.-
value
material.uniforms.uApplyBlur.valueA floating point value. Either
0.0(false) or1.0(true).The default value is
1. -
type
material.uniforms.uApplyBlur.typeThe 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.uAnimateNoiseWhen blurring is applied to your text, as determined by the
uApplyBluruniform,ChannelSplitMaterialwill apply a subtle amount of noise distortion to the sampled RGB channels. This is both for performance and aesthetic reasons. TheuAnimateNoiseuniform 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.valueA floating point value. Either
0.0(false) or1.0(true).The default value is
1. -
type
material.uniforms.uAnimateNoise.typeThe 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.
-
-