crackShardCompose

The finished glass: the three refracted channels blended into the crack, with a hint of light on tilted shards.

crackShardCompose(
  normalColor: v4f,
  rFinal: v4f,
  gFinal: v4f,
  bFinal: v4f,
  crackIntensity: number,
  disp: v2f,
  shardLighting: number,
): v4f

Import effects from shaders/std and use effects.fracture.crackShardCompose.

Pass the plain sample at displacedUV, the red, green and blue samples from crackRefractUV, then crackIntensity and disp from crackGeom, and shardLighting (0 to 0.5). The samples come from the layer's texture, so unpremultiply the result before returning it.

Parameters

NameTypeNotes
args[normalColor: v4f, rFinal: v4f, gFinal: v4f, bFinal: v4f, crackIntensity: number, disp: v2f, shardLighting: number]

Example

const glass = call(crackShardCompose, 'crackShardCompose', [plain, red, green, blue, geom.member('crackIntensity'), geom.member('disp'), uniforms.shardLighting])

See also

  • crackRefractUV — Where to sample one color channel so the crack bends the light and splits it like a prism.
  • crackGeom — How much crack there is at a pixel, and which way the shard under it has moved.

Used by

Shatter