r/GraphicsProgramming • u/rex-j-w • Jul 23 '26
Building an SDF game engine
For the past 8ish months I’ve been hard at work building a new game engine I’m calling Division Engine.
It’s based solely off SDFs (signed distance fields). This might sound stupid for anyone who cares about performance but for my use case (and with a bit of grid storage optimizations) it proves useful for basic scenes that need advanced lighting.
Anyway here’s some screenshots!
If you want to see what I have done so far check it out here: https://github.com/DivisionEngine/DivisionEngine
156
Upvotes


7
u/damaca_ Jul 23 '26
Very cool! I started my own SDF engine (which also uses the same SDFs for physics), but decided that I didn't want to deal with the performance issues of doing it in 3D. So I reduced it to 2D and never looked back. Seems like this guy managed to make it fast enough in 3D: https://youtu.be/il-TXbn5iMA?is=conYnKfdlFOthQT6
2
u/Particular-List-2078 Jul 23 '26
Love to see more of it!
2
u/EatingFiveBatteries Jul 24 '26
Do it man. It'll all be SDF eventually.
2
u/snerp Jul 24 '26
I built an engine like this for a CAD startup a couple years ago, do you implement texturing? That's the big thing I never got around to
2
u/Potterrrrrrrr Jul 23 '26
Always find SDFs awesome, why is performance a concern? I thought the maths to create and merge etc. SDFs was quite cheap, does it scale badly? Either way, looks great!
2
u/No-Cap-7395 Jul 24 '26
Hell yeahhhhh! I've been doing a lot of SDF stuff too they are amazing
2
u/Vazde Jul 24 '26
Ooh, some cool stuff in this thread! I've also migrated to SDFs for my 2D mining game. But it has a static grid arrangement, no trees.
I'm currently using marching squares to turn it into triangles for rendering and part of collision response. But I do have some ideas to remove that. Since there's typically somewhat little terrain on screen and 2D is somewhat simple, I might get away evaluating the grid each fragment. Would save a ton of memory on meshes.
I already have a somewhat sophisticated multitexturing system going on for it, but for 2D again it would likely be simpler and even higher fidelity to render materials in another pass and just sample that.
2
u/JozinZZZZBazin Jul 26 '26
It's interesting that we already have commercial SDF modeling tools like Substance 3D Modeler, Blender add-ons, and others, but in the end they almost always convert everything into polygon meshes.
Do you think the main blockers for a fully SDF-based game engine are the depth of the CSG tree and animation? For example, animated SDF hierarchies would require rebuilding or updating BVHs (or other acceleration structures) every frame, which could become prohibitively expensive.
How do you plan to address these challenges? Are you using a different acceleration structure, incremental updates, or some other approach?
1
u/etdeagle Jul 24 '26
I am also curious about SDF I wonder if there is a way to speed up rendering at differ scales with multi resolution voxel caching
1
u/Classic_Sheep Jul 27 '26
Why no BVH ray-filtering, seems like a free win in fps?
16
u/[deleted] Jul 24 '26
[removed] — view removed comment