Log inGet started
Package

snow_trail.computeShader

README.md

snow_trail

The ski trail, as its own geometry: a ribbon dense along the track and shaped across it, lifted into place by one compute dispatch a frame.

What it has to look like

Read off the reference (a snowboarder carving deep snow, low sun across the slope). Each line is a claim the geometry has to answer, and the whole point of writing them down is that "closer than it was" is not one of them.

  1. The displaced snow is a ROLLED ROPE, not a bank. The outside of the turn carries a thick, round, continuous roll of snow — a tube lying on the surface, its top clearly above the untouched snow around it. It is the largest thing in the frame after the rider: of the order of a metre thick, comparable to the rider's own body. A smooth swell a few centimetres proud is not this.
  2. One broad trough, not two grooves. In snow this deep the track is a single smooth trough the width of the board, its floor in blue shadow, its far wall rising into the roll. Two thin parallel grooves belong to a groomed piste, not to this.
  3. The roll is asymmetric. Nearly all of the displaced snow is on the OUTSIDE of the turn. The inside has a small lip at most.
  4. The trough floor is smooth and the roll is granular. The compressed floor reads as polished; the roll reads as broken clods, because it is snow that has been thrown rather than pressed.
  5. The roll overhangs its own base. Its outer face is steeper than the snow would stand at, because it was pushed there — it is not a pile that settled.
  6. The trail persists and reads at distance. Earlier parts of the track are visible across the slope as a thinner line, so the shape has to survive being small on screen as well as filling it.
  7. Depth follows the turn. Where the turn is hardest the trough is deepest and the roll is biggest; where the track runs straight both fall away to almost nothing.

The reference frame itself lives in the conversation that set this work off; what is durable is the list above, which is what a capture gets held against.

How it is driven

The CPU appends one track sample per frame into a RING buffer, so the trail runs for ever rather than filling up: the ribbon's first segment is always the newest sample and the rest trail backwards through the buffer. Old samples settle as they age, because snow relaxes.

Dispatch it over the ribbon's vertices, ceil(count / 64) groups.

Buffers

bindingnamerole
0verticesthe ribbon's vertex buffer, written in place
1trackthe ring of track samples, 8 floats each
2ctrlthe parameters below

A track sample

slotmeaning
0, 1centre x, z
2, 3unit vector across the track
4ground height at the centre
5edge load, 0..1
6cross slope, metres of rise per metre across
7which way the turn is loaded, -1 or +1

ctrl

slotmeaning
0vertex count
1vertices across the ribbon
2samples written in total (the ring's head)
3segments the ribbon has
4trough half width at full load
5roll width
6roll height at full load
7trough depth at no load
8trough depth added at full load
9how far the roll overhangs its base, 0..1
10how much of the roll is clods, in metres
11inside lip as a fraction of the roll
12samples over which an old track settles
13how much of its depth a settled track keeps