# Choose visible geometry

Show surfaces, authored lines, or exact glTF primitive instances without changing the submitted model.

Canonical page: https://www.nanoraster.xyz/docs/guides/choose-visible-geometry

Presentation filters decide which submitted primitives reach the draw plan.
They do not rewrite the GLB. Shared filters apply to every camera in a batch;
each view may override `visiblePrimitives`.

## Switch surfaces and lines independently [#switch-surfaces-and-lines-independently]

`surfaces` controls `TRIANGLES` primitives. `lines` controls authored `LINES`
primitives. Both default to `true`.

```typescript
import { renderImage } from 'nanoraster';

const image = await renderImage(glb, {
  format: 'webp',
  surfaces: true,
  lines: true,
  visiblePrimitives: [
    { nodeIndex: 0, meshIndex: 0, primitiveIndex: 0 },
    { nodeIndex: 0, meshIndex: 0, primitiveIndex: 1 },
  ],
});
```

Turn off `lines` for a shaded render. Turn off `surfaces` for an authored
line drawing. Section-cap outlines remain part of a shown section surface, not
authored line primitives.

## Select primitive instances [#select-primitive-instances]

`visiblePrimitives` is an allowlist of source glTF indices. `nodeIndex`
identifies the instance, `meshIndex` identifies its referenced source mesh,
and `primitiveIndex` identifies the primitive inside that mesh. The node index
matters when several nodes instance one mesh.

Omit the option to admit every reachable primitive. Pass `[]` to admit none.
Unknown, mismatched, or duplicate references fail with `RenderError` code
`parse` rather than producing an incomplete image.

```typescript
const edges = await renderImage(glb, {
  format: 'png',
  visiblePrimitives: [{ nodeIndex: 0, meshIndex: 0, primitiveIndex: 1 }],
});
```

A fitted camera frames the admitted surfaces and lines. If the request admits
no geometry, fitted framing fails: there is no subject. A fixed camera may
still render a background and annotations.

For a batch of different parts, set `visiblePrimitives` on each view. The
renderer validates each selection and fits its camera to that part while
sharing one GLB parse and upload. Omit the view field to inherit the shared
selection. Per-view selection with `sections` is unsupported until section
caps can be prepared for each view.

## Resolve product identity before rendering [#resolve-product-identity-before-rendering]

The renderer accepts document identity, not application component IDs. Keep
the mapping from assemblies, layers, hide state, or isolation state in the
caller that owns those concepts. Then send one final allowlist. This split
keeps the request serializable, and it makes the same render portable to a
worker or a remote renderer.