Wind Down | by Tomkh | Making Of

This is behind-the-scenes story of making Wind Down, a short 8k intro in Javascript/WebGL.

First you can check it out here.

You need WebGL-enabled browser, like the latest Google Chrome (recommended) or Firefox,
and pretty decent GPU;)


Most demoscene intros (from 4k to 64k) these days are just drawing single quad on screen
and rendering the whole scene by ray-marching SDF (signed distance field).
The technique proved to give pretty good results, like Timeless 64k, and many other examples.
However, there is a drawback - it is difficult to handle really big and complex scenes.
You can use some tricks like domain reflections/rotations, which is very well explained here,
but a well-trained eye can always spot a regular pattern behind.
My motivation was to further investigate alternative ways of rendering complex
scenes by compositing multiple smaller SDF objects using polygon rasterization.

From concept to initial prototype

Initially I wanted to do something really big, but I quickly realized there is
simply not enough time before the deadline;) so I decided to do something small and short
The idea was to make something less abstract, a short scene taken from reality.
I've started with a simple shader, pure SDF and ray-marching:

It took me a while to figure out how to make procedural sand dunes and sand texture.
It still needs more work, but for the start it was good enough and promising.

Almost in parallel I did a simple tune using pretty awesome and easy to use JS-synth/tracker.
The fact I used existing synth (instead of making my own) and crunching tool
saved me additional time and hassle.

I wanted to make something melodic and a little sad to set a proper mood for the intro.
You can check out the score of my tune over here.

Plot and references

I used couple of reference images along the process to adjust colors or simply get
inspiration from.

The idea was to make the story a little more serious. Not really with a big message,
but at least thought-provoking. Serene landscape, beautiful sun-rise and people
killing each other (what is the real reason, again?)

Compositing multiple SDFs

It was time to add some rocks and other objects on a rather boring and sterile sand dunes.

First, I've modeled SDF of a single rock. Nothing fancy, just multiple half-planes
with smooth maximum operator to find intersection, plus some noise on top of it.
Then I placed a lot of them with a slight variation in shape and color.

Here is the result:

From the screenshot on the left you can already figure out rendering technique.
In short: every object on a scene has its own orthogonal coordinate system
and its bounding primitive (here just polygonal cube) gets rasterized.
Then per-pixel ray-marching is going through SDF to find an actual surface and shadow.

As you can also see, bounding primitives are not really tight,
it's because they have to also enclose shadow!
This is unfortunately causing a little more overdraw and performance-drop, but unfortunately
(due to time constraints) I couldn't find a better way.
Of course I could use shadow-map (i.e. cascaded maps), but well, first of all, maybe not in 8k,
as it really takes some code to implement it. Nevertheless, it would be interesting to find some
faster technique in the future.

Shells and bullets

Since it was 8k, I obviously didn't go for fully-featured soldiers with guns,
but bullets with shells sounded like a good idea and easy enough to do.

To model them I did some browsing for reference images as well.
And here is what I found: stock photos on the left, and on the right - my best approximation
of a bullet in a cartridge using SDF:

I've also modeled empty shells to keep it more realistic.

Winding things up (or down)

After finishing all scenes, it was time for painful process of putting things together,
fine-tuning and removing all rendering artifacts!
I think the polishing stage is what can really make a difference between
solid quality release or something that looks a little bit unfinished.
Unfortunately I didn't have too much time left (as usual), mainly one day or actually
half a day (party already started) so I could only do my best!

Please enjoy the intro once again and stay tuned for
something better/bigger/faster in the future!

- Tomkh, October 4th, 2015