Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public final class Toon

  1. Object
  2. Toon
Stylized, non photographic shading. These compute their own lighting from the sun, so use them on a Material.Type.UNLIT material: the material’s colour and texture are the paint, the graph decides the light.

Fields

public static final String BANDS = "toonBands"FLOAT the number of light bands, 2 to 5.
public static final String SHADE = "toonShade"VEC3 the colour of the shadowed side, multiplied into the paint.
public static final String RIM = "toonRim"VEC3 the rim light colour; black for none.
public static final String DENSITY = "toonDensity"FLOAT hatch lines per world unit.

Methods

public static ShaderMaterial cel()Cel shading: light in hard bands with a thin soft step between them, a cool shadow tint and a bright rim.
public static ShaderMaterial hatching()Pen hatching: the darker the light, the more crossing lines, drawn in world space so they stay put as the camera moves.
public static ShaderMaterial lowPoly()Flat faceted low poly look: one colour per face by height, toward the sun or away, with no smooth gradients.

Inherited methods

Field details

BANDS

public static final String BANDS = "toonBands"
FLOAT the number of light bands, 2 to 5.

SHADE

public static final String SHADE = "toonShade"
VEC3 the colour of the shadowed side, multiplied into the paint.

RIM

public static final String RIM = "toonRim"
VEC3 the rim light colour; black for none.

DENSITY

public static final String DENSITY = "toonDensity"
FLOAT hatch lines per world unit.

Method details

cel

public static ShaderMaterial cel()
Cel shading: light in hard bands with a thin soft step between them, a cool shadow tint and a bright rim.

Returns

a new shader material

hatching

public static ShaderMaterial hatching()
Pen hatching: the darker the light, the more crossing lines, drawn in world space so they stay put as the camera moves.

Returns

a new shader material

lowPoly

public static ShaderMaterial lowPoly()
Flat faceted low poly look: one colour per face by height, toward the sun or away, with no smooth gradients.

Returns

a new shader material