You are currently viewing Kraymarch


Kraymarch is a tool that allows the user to create 3D models out of signed distance functions (SDF) which get turned into a fragment shader and rendered onto just two triangles forming a quad.

I was inspired by Inigo Quilez, who in my eyes is the modern day Bob Ross in terms of art made from “maths” (as he likes to call it) and I wanted to use this approach to generate assets for games while requiring very little data and can be rendered locally, turning it into 2D images.


Being passionate about procedural generation, one of the most compelling aspects of that field is to make something (visually) stunning out of very little data combined with a potent algorithm that turns said data into something any modern computer can generate on the fly, often in real time.

When I started to make my latest game, I wanted to cheap out on the assets to get things going quickly. I soon after realized, that a compelling game is not only fun to play but, just as important, pleasing to look at for extended periods of time. That realization might be obvious to some/many and to a degree I knew that already, but it quickly made me grind to a halt in that project.

To get back into gear, I looked for a way to make that game look good, while still keeping the game that is targeted towards smartphone users very small in terms of size to download and storage used on device.

At first I implemented the marching cubes algorithm to generate 3D meshes but I wasn’t all too happy with the result of what I managed to get out, using that technique. Then I remembered watching videos about a technique called “raymarching” and it instantly clicked in my head.

What can it do so far?

Currently, Kraymarch lets you add a large assortment of configurable geometric 3D primitives, it has two base types of CSG operations (smooth and sharp) and it comes with a decent assortment of other operations.

Here is a quick demo video of adding a primitive and enabling mirroring:

What do I want it to do once it is finished

I would like Kraymarch to eventually be a vital tool in my asset pipeline, where I can design models and export the “recipe” to be used further down the asset pipeline in actual projects.

In my first use case, I want to use it as a sort of customizable avatar generator, so I want to enable a degree of modularity in the exported recipes, so the end user will have the ability to freely mix together and modify their avatar to their liking, including adding flair in the form of accessories to them, which can be delivered as separate but compatible “recipes”.

At some point in the future, I want to add the capability of animating the models, so they aren’t “just” static models, but rather could also turned into moving avatars/character models/…

Could it become more?

I sometimes daydream about turning it into a sort of 3D engine. Your average PC with dedicated GPU has enough oomph to run quite complex scenes at respectable framerates these days. 

So instead of using a quad to perform the raymarching in, it could instead be used in an actual 3D scene made up of rough bounding boxes for each model and then do the same raymarching on the exposed surfaces, correcting for camera position of the 3D scene.

While I probably could make it work with many limitations, this is just a daydream that likely isn’t sensible for me to pursue, but one never knows what the future brings.

Another enhancement could be to introduce some form of export to 3D mesh functionality at some point. But tbh, with powerful 3D modeling tools like Blender and alike out there, I don’t really see a point in making this, unless I actually develop a need in one of my projects to make implementing that worthwhile.

Leave a Reply