Modules / Rendering & look

cel3dplugin

Draws the 3D scene as cel animation: light in flat bands, a hard highlight, a rim light and ink outlines.

Putting it in a scene

Add it to plugins with render3d. It shades every dressed material in flat bands of light and, optionally, draws an ink line round every shape. It needs a directional light in the scene to do anything.

"plugins": ["loader", "scenemanager", "player", "skydome3d", "render3d", "cel3d"],
"world": {
  "cel3d": {
    "bands": [{ "at": 0, "level": 0.35 }, { "at": 0.3, "level": 0.7 }, { "at": 0.65, "level": 1 }],
    "soft": 0.02,
    "shade": "#7a6a9a",
    "spec": 0.9,
    "gloss": "#ffffff",
    "rim": { "width": 0.3, "strength": 0.4, "colour": "#ffe9c4" },
    "outline": { "width": 1.5, "depth": 0.02, "ink": 0.25, "colour": "#ffffff", "fade": [30, 200] }
  }
}

Properties

Read from world.cel3d, once.

.bands : { at, level }[]

The steps of light. at is how much of the light a surface receives, 0 for none and 1 for facing the light with nothing in the way. A surface takes the level of the last band whose at it has reached. The first band must be at 0, and each later at must be higher than the one before.

.soft : number

How far each step is blended, on either side of its at. 0 gives hard edges.

.shade : colour

The colour the sky's light is multiplied by where a surface is out of the light, so shadows take on a hue instead of only going dark.

.spec : number

The highlight threshold. Where a surface's specular light reaches this fraction of the light's, it shows one hard highlight in gloss, and nothing elsewhere.

.gloss : colour

The colour of the highlight.

.rim : { width, strength, colour }

Optional. A band of colour where a surface turns away from the viewer. width is between 0 and 1, and strength is how much light it adds.

.outline : { width, depth, ink, colour, fade }

Optional. Draws an ink line wherever one shape stands in front of another or a surface creases. width is the line's width in pixels. depth is how sharp a depth change must be to start a line, and it is fully inked at twice that. ink multiplies the colour of the line's pixels, and colour multiplies them again, so a line is a darker shade of what it outlines. fade is [near, far] in metres from the camera over which lines fade out. Without outline, no lines are drawn.

In the guide