All examples · Meshes and 3D

Vertex snapping

What this example shows

The PlayStation shivered: every corner of a model landed on a coarse grid of the screen, so models jumped from step to step as they moved and the edges of a floor crawled as the camera turned. vertexSnap on a material (or on createModel and createMesh) is exactly that, and the number is how many rows the grid has.

The fox and board on the left are drawn as a modern card would; the ones on the right snap to an 80-row grid. Press space to switch it on and off live.

Why a grid coarser than the game's 240 rows? Because the picture is already drawn on those 240: snapping to them moves a corner less than half a pixel and nobody sees it (that is what vertexSnap: true does). The console did its maths with low-precision numbers and missed by more than a pixel, which is why a coarser grid is what reads as PlayStation. 120 is the classic look, 80 is easy to see and 60 takes the model apart.

In full screen it fills the whole monitor: keep: 'height' pins the 240 rows and lets the width follow the screen, so a wide monitor sees more to the sides instead of black bars.

Starting