Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Condition: A 64KB WebGL Intro (github.com/fms-cat)
127 points by polm23 on April 5, 2021 | hide | past | favorite | 48 comments


I was there when it was shown. Awesome.

For the context, this intro got third place at Revision PC 64k competition.

Revision is the largest "pure" demoparty, and its competitions are of the highest level, especially this year. The PC 64k category is one of the most demanding, as nowadays, you are expected to make a full demo, with good sounding music, direction, multiple scenes, etc... but with the 64k constraint, which, in practice, means that everything has to be procedurally generated.

And FMS_Cat did all that by himself! Code, graphics and music. He also manages to stay humble about it. Big thumbs up.


How.... did you do this. I must learn. Did you really just code all of it? Or did you make it in blender and export to gltf? I’m a music producer and a blender user who has been learning webgl using pixiJS and babylonJS. I want to know how to get to this level.


These demos tend to make heavy use of raymarching, which is an alternative way of representing geometry that doesn't rely on polygons. This is why these demos are often so small; they generate 3D scenes using what are known as 'distance field' equations, rather than loading in the polygon data from some external file (like a gltf).

Basically, you'll need to learn to write shader code if you want to replicate this. A good place for beginners to start is The Book of Shaders[0]. It doesn't mention raymarching specifically, but it will give you the building blocks to understand it later.

Once you have a basic understanding of shaders, check out the site of Inigo Quilez[1] to learn more about raymarching and distance fields.

[0]: https://thebookofshaders.com/ [1]: https://www.iquilezles.org/www/index.htm


Demos are almost always generated and displayed at runtime. The music is composed of samples generated at runtime by additive synthesis which is just adding waveforms of differing frequencies together when you get down to it. It doesn't take many lines of code to produce CD quality instruments that can be arranged as a soundtrack.

Today's 64k intros offload their drawing onto the GPU using shaders and a technique called raymarching which is a form of fixed-step raytracing that can be done in real time. Essentially the objects you see are painted with math: instead of thousands of vertices for a 3d fractal or a complex object, a formula is fed in to the ray marcher and it returns a shape with colors and lighting. Combining shapes using unions and intersections is then done and often the shape formula will take time as a parameter as well. To play with this concept yourself go to https://www.shadertoy.com/browse and see how shader programs are rendered into incredible scenes with astonishingly few lines of code.

For a wonderful look at the creation process, see the grandfather of raymarching Inigo Quilez create a selfie of a girl from scratch using formulas here: https://www.youtube.com/watch?v=8--5LwHRhjk


The way this is traditionally done is by writing a demomaker tool, then writing a player for the procedures (instructions) which the demomaker generates.

One can then generate the instructions to the 3D rendering engine and the highly custom software synthesizer in the player. This information easily fits in (less than) 64 KB. The achievement is not in the final result, but in writing the demomaker.

The German group Farbrausch (former Sanity on the Commodore Amiga) was the first to invent this procedural generation technique. Almost two decades ago, they wrote their own demomaker called .werkzeug (.tool).

https://weblogs.asp.net/fbouma/162232


To be pedantic, Farbrausch definitely popularized using a custom tool but they were being built in years prior, as well.

Source: Wrote a tool in 1998 for our not-great-looking 64k intro "Pure" by demogroup Quad.


To be pedantic, Red Sector Inc. ("RSI") was the first with the "RSI demomaker" back in 1990 / 1991, which predates everybody and their brother. Just don't retort with 711's intro designer III (https://csdb.dk/release/?id=21021), because that's not a demo maker and then we'll have to go back even further to "Demo Demon" (https://csdb.dk/release/?id=174097, https://csdb.dk/release/?id=2700)...


Yeah! (only an aspiring 'scener here) but I think "you really just code all of it" is a very nice summary of one of the core ideas of the demoscene.

In "full size" demos there are often many exceptions to that: Non-procedural assets (some exported from other software) like soundtrack, models, textures, animation and so on, which really expands the possibilities, it's really just the tiny size categories that squeezes them out (maybe also that compression ends up slightly less interesting/useful than creative reconstruction?). There's also strong respects paid for achieving something that previously required a large blob of data, using a tiny amount of code, like all the cool voice synth stuff that was used to add lyrics to 64kb intros years ago (eg: Candytron by Farbrausch that was released at Breakpoint in 2003!).


oh boy... type "demoscene" into google and go down the rabbit hole.


Of course; we have a long tradition, as we have existed for many decades now.


For the demo, the Final Versions didn't work for me, but the Dev Builds did: https://fms-cat.com/condition/pages/ Pretty impressive though!


> For the demo, the Final Versions didn't work for me

Me neither. I just see this: https://i.imgur.com/qzP0Qwb.png


I think that's by design (minimization technique).

Leave the page open for a minute or so, and it will advance. It did the same for me.


It works (after a while) in Chromium on Linux for me but Firefox 87 for Linux just displays the gibberish


Hmm. Interesting. Only in Chrome though?


It worked in Firefox for me, just took a moment to get past the gibberish text


I also get gibberish both on Brave and Chrome on Linux.


If you have a slightly slower connection, it's not really gibberish. It's a page that has a ton of binary data in it, and then some JS to introspect itself and evaluate it.


FMS Cat also shared a list of some of his inspirations for this demo on Twitter.

https://twitter.com/FMS_Cat/status/1379090489488470018


One of the cool aspects of this demo is that it is open source. Not many demos are, in fact, most are not. Some technical aspects are revealed in talks and workshops, but rarely the source is given.

The music is done with a shader, which is in itself insane. https://github.com/FMS-Cat/condition/blob/dev/src/music/musi...


Not that insane actually,

https://www.musictech.net/guides/essential-guide/how-fm-synt...

https://github.com/askeksa/Cinter

Going into more modern examples,

https://docs.microsoft.com/en-us/windows/win32/xaudio2/xaudi...

"Realtime GPU Audio" - https://queue.acm.org/detail.cfm?id=2484010

Because WebGL doesn't expose compute shaders, one is stuck misusing the vertex shader for the same purpose.


> The music is done with a shader, which is in itself insane.

I don't really see any advantage/disadvantage to doing music with a shader Vs CPU.

No modern CPU would struggle with the computation for this code, and nor would a GPU. It seems it's just a matter of the programmer being more familiar with the world of graphics.


I've heard a GPU synth can be smaller. Not familiar with them enough to know exactly why.


The entries this year at Revision were almost definitely a technical and artistic high-note for the scene.

The demo More by mfx was also in Javascript I believe and was also quite incredible.

https://www.pouet.net/prod.php?which=88631

For people interested, check out https://www.pouet.net/party.php?which=1550&when=2021 for the list of entries and results and https://www.youtube.com/c/RevisionCaptures/videos for video captures of all the entries. Some incredible stuff, including a GPU powered synth.


This is my favourite demo from the same competition: https://www.youtube.com/watch?v=O3T1-nadehU


That was awesome!


It looks great, but the startup time, oh boy it takes ages beyond loading 64KB demos on Amiga and MS-DOS PC, then one wonders why WebGL games don't take off.


Long startup time are norm in size-limited entries. E.g. the winning 64k entry had about 10-15s load time on the very high end party computer, and it is a native windows executable: https://youtu.be/6INL_pxX8L4


27 seconds on the Youtube video for the first pixel drawing.

On this ThinkPad P15 G1 workstation, it took about 2 minutes on Firefox and makes the browser unresponsive to anything other than the click me text.

Not at all comparable.


The minified version is broken for me with "VM9:2 WebGL: too many errors, no more errors will be reported to the console for this context" and the source is unreadable.

But the dev build at https://fms-cat.com/condition/pages/condition_640x360_dev.ht... works.


That's just a warning telling you no more warnings will be printed. It's still more time before the page will change to "click me" where you can start the demo. The dev version is unpacked so you don't have to wait for this.


Make sure your gfx card is good enough. For me, not so much:

glcat.module.js:1109 Uncaught Error: GLCat.getExtension: The extension "EXT_disjoint_timer_query_webgl2" is not supported at GLCat.getExtension (glcat.module.js:1110) at new GPUTimer (GPUTimer.ts:17) at new Component (Component.ts:115) at new Quad


For some reason I'm getting a PNG file if I curl this url:

https://fms-cat.com/condition/pages/condition_1920x1080_fina...


Try "open in a new tab", worked for me.


How do I open a new tab in curl.


The attention to detail and the pace is impressive. Very Japanese demo style indeed.


doesn't work in firefox-beta / linux for me (dev version errors about GL functions). sort of works on chrome, but stutters... (amd ryzen pro 4750u / ubuntu 20.10)

from what I _can_ see it looks cool. I used to love demos in the old days on my 386 with gravis ultrasound :)


Wow! This is so impressive, I get old school PS2 / Kingdom Hearts / DDR vibes from this.


The music was fantastic, as were the visuals. Damn


Very well done!

This was clearly inspired by Gantz Graf by Autechre:

https://www.youtube.com/watch?v=ev3vENli7wQ


Here's the list of some of his inspirations: https://twitter.com/FMS_Cat/status/1379090489488470018


'Glitch' by Kewlers was out around a similar time as Gantz Graf, and has some similar vibrations:

http://www.pouet.net/prod.php?which=10058


A central rotating/pulsating object and some surrounding graphical effects, timed with music, has been done in the demo scene for decades. It's doubtful Gantz Graf was inspiration for this or most other such demos.


Thank you, oh expert on rotating/pulsating objects and some surrounding graphical effects, timed with music. I am humbled.


Mmm none of these work for me on iOS Safari. Just loads gibberjish.


Blame Apple. Safari still doesn't support the Web Audio API in a standard compliant way. it's been 10 yrs since the Web Audio API shipped and it's still only available in Safari as "webkitAudioContext" instead of just "AudioContext"

My guess is that's not the only place Safari falls short for this demo. You also need WebGL2 which Apple has only shipped behind a flag this year. Firefox and Google shipped without a flag 4 years ago


Here's a nickel kid, get a real browser </dilbert> :)

See:

https://i.pinimg.com/originals/6a/09/f4/6a09f4c78c82187da893...


iOS browsers are miles behind. Sorry.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: