Rendering the Swarm, a Rationalization of a Stupid Idea

As well as going off on tangents while researching, this project is somewhat preselected as an excuse to work on stuff that currently interests me while keeping the possibility of dropping any one of them at any time upon imminent failure to implement or integrate.

Three of the main technical topics of interest of this project are agent based group behaviour, artificial neural networks and raymarching. Two of the former having been explained in the last devlog post, I will now go into the third.

As a technical artist, I take interest in content creation and rendering pipelines, optimizations, engine architecture and other various specifics of the modern game creation toolchain. But for this passion project, I aim to feed my thirst for odd tech and anything I don’t get to do on my day job.

Raymarching is a real-time approximation of raytracing, long-known in the demoscene. In modern game engines, raymarching is mostly used for little more than volumetric fog and lights and rarely for rendering geometry itself (if at all). Unlike the conventional polygon-soup method, raymarching is great for rendering mathematically defined objects. This is where my interest in the tech comes in. For smooth objects that are visually complex but mathematically simple (fractals for example), raymarching blows old fashioned marching cubes out of the water (in rendering code simplicity if not for performance).

I’ve been playing around with some crazy ideas for a SDF (signed distance field) based modelling and rendering engine but for this project, I’ll keep it to metaballs based on Inigo Quilez little pieces of SDF math.

My reasoning for using implicit metaballs to render the flocking AI is to make the resulting swarm seem truly amorphous. The simple plan is to keep the number of flock agents as low as possible but as high as needed for NN training while adding more detail via SDF domain operations and deformations.

First brute force tests of metaball flock rendering aren’t going too well performance wise but I have several radical optimizations in mind so it shouldn’t be a massive issue. If all else fails, I’ll render the game in 64x48 and call it pixel art.

Leave a comment

Log in with to leave a comment.