---
contentHash: sha256:153ae8ae430413e82d9bbb5ed673120f055857a96348839968b4f6efa82692ae
documentId: element:sk-surface-paint
kind: element
schemaVersion: 1
skenraVersion: 0.1.0-alpha.1
---
# sk-surface-paint

<a id="overview"></a>

## Overview

Fills a node's triangle faces with a material — the ordinary way to make a mesh
look solid, giving its surface a color and shading rather than just an outline.

This is the surface member of the Paint family: like every paint it
applies a material to one part of a node's geometry; here that part is the
filled triangle surface, so the material's base color, tonemap, and lighting
response are what you see across the object's faces.

**Key attributes.** `material` (inherited from Paint) references the
material to render by id. `cull-mode` chooses which triangle faces to draw:
`back` draws only front faces — right for a closed solid; `front` draws only
back faces; and `none` draws both sides, which is what open or flat geometry
(a disc, a plane, a one-sided ribbon) needs so it does not vanish when viewed
from behind. Left unset, it follows the mesh's own default — `back` for most
solids, but `none` for open shapes like discs and planes. `selection` binds the
paint to a subset of the mesh's faces instead of the whole surface: it takes a
`#id` reference to a sk-selection authored on the same mesh, so several
paints on one mesh can fill disjoint face sets — a cube rendered as a die is six
selection-bound paints on one cube. Left unset, the paint fills the whole surface
(the original behavior); an unresolved selection draws nothing rather than
silently filling the whole mesh.

**Related.** A sk-selection names the faces this paint targets. Its
sibling paints cover the other parts of the geometry: sk-edge-paint
(wireframe edges) and sk-stroke-paint (spline strokes); several paints
can stack on one node in document order. The material it applies is a
sk-plain-material.

<a id="example"></a>

## Example

```sk
<!-- One cube rendered as a die: six <sk-selection> children name the six face
     triangle pairs of a size-2 cube (2 triangles per face, emitted in
     +X, -X, +Y, -Y, +Z, -Z order), and six selection-bound surface paints each
     fill one face with its own colour — six materials on a single mesh, no
     per-face child geometry. The top paint sets cull-mode="back" explicitly (the
     solid-cube default) to show the two controls together; the rest inherit it. -->
<sk-scene>
    <sk-directional-light p="42deg" h="25deg" intensity="1.0"></sk-directional-light>
    <sk-ambient-light intensity="0.4"></sk-ambient-light>

    <sk-plain-material id="pips1" base-color="crimson"></sk-plain-material>
    <sk-plain-material id="pips2" base-color="goldenrod"></sk-plain-material>
    <sk-plain-material id="pips3" base-color="seagreen"></sk-plain-material>
    <sk-plain-material id="pips4" base-color="steelblue"></sk-plain-material>
    <sk-plain-material id="pips5" base-color="darkorange"></sk-plain-material>
    <sk-plain-material id="pips6" base-color="rebeccapurple"></sk-plain-material>

    <sk-cube size="2">
        <sk-selection id="die-right"  indices="0-1"></sk-selection>
        <sk-selection id="die-left"   indices="2-3"></sk-selection>
        <sk-selection id="die-top"    indices="4-5"></sk-selection>
        <sk-selection id="die-bottom" indices="6-7"></sk-selection>
        <sk-selection id="die-front"  indices="8-9"></sk-selection>
        <sk-selection id="die-back"   indices="10-11"></sk-selection>
        <sk-surface-paint selection="#die-top"    material="#pips1" cull-mode="back"></sk-surface-paint>
        <sk-surface-paint selection="#die-bottom" material="#pips6"></sk-surface-paint>
        <sk-surface-paint selection="#die-front"  material="#pips2"></sk-surface-paint>
        <sk-surface-paint selection="#die-back"   material="#pips5"></sk-surface-paint>
        <sk-surface-paint selection="#die-left"   material="#pips3"></sk-surface-paint>
        <sk-surface-paint selection="#die-right"  material="#pips4"></sk-surface-paint>
    </sk-cube>
</sk-scene>
```

<a id="children"></a>

## Children

Optional spatial-field children (gradient/noise/random fields) modulating per-pixel surface coverage.

<a id="attr-id"></a>

## id

Type: `<id>` · Required: no · Animatable: no

Related: [`type:id`](types/id.md)

<a id="attr-material"></a>

## material

Type: `<id-ref>` · Required: no · Animatable: yes · Inherited from `Paint`

Gets the material this paint applies.

Related: [`type:id-ref`](types/id-ref.md)

<a id="attr-selection"></a>

## selection

Type: `<selection-token>` · Required: no · Animatable: no

A single-token reference to a Selection restricting which faces this

Related: [`type:selection-token`](types/selection-token.md)

<a id="attr-cull-mode"></a>

## cull-mode

Type: `<cull-mode>` · Required: no · Animatable: yes · Default: `"back"`

Face culling mode for triangle rendering. Left unset, the paint inherits the

Related: [`type:cull-mode`](types/cull-mode.md)

---

Related records: [`type:cull-mode`](types/cull-mode.md), [`type:id`](types/id.md), [`type:id-ref`](types/id-ref.md), [`type:selection-token`](types/selection-token.md)
