Signed Distance Fields in Kha
Signed Distance Fields (SDF) and raymarching are techniques used in the demoscene to make impressive renders in not much code and with limited computing power. I am not in the demoscene, but I was curious if raymarching and Signed Distance Fields could be used in games as an alternative to polygonal rendering. Kha is a really cool multimedia framework based on Haxe.
I wanted to make game objects out of SDF and then pass them to the GPU to be rendered, but I ran into a limitation of Kha. It doesn’t yet support Uniform Buffer Objects. Without this, it is hard to send custom data (not vertices) to the GPU.
My naive implementation of raymarching on SDFs doesn’t have quite the performance I was hoping it would get. Every object added to the scene adds a considerable slowdown, since every object has to be checked for every pixel, for every step along the ray march. If I could send objects from the CPU to the GPU, it would be relatively easy to frustum cull and limit the number of objects that needed to be considered. Maybe I will revisit this project in a different language.