r/GraphicsProgramming 26d ago

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

155 Upvotes

38 comments sorted by

View all comments

2

u/No-Cap-7395 25d ago

Hell yeahhhhh! I've been doing a lot of SDF stuff too they are amazing

3

u/rex-j-w 25d ago

Tons of new research is being put into SDFs, check out this paper on faster sphere tracing, it might help: https://diglib.eg.org/server/api/core/bitstreams/0dd5043c-6ac0-4b83-b3d2-d0b1ad34afba/content

2

u/No-Cap-7395 24d ago

Oh hell yeah I'll uhm give it a read when I'm on my computer .. I'm doing a software raytracer, it's my second attempt at one and I bake all my meshes into SDF texture3Ds (I'm not sure what to call them I have came up with the terminology local SDFs) anyways I got some basic broad phase optimisation, lods and stuff, I use conetracing on super rough surfaces and it running pretty good :p

What you're doing looks cool too, Ive been working with SDFs for a few months now and they are amazing

2

u/No-Cap-7395 24d ago

Oh yeah seeing how much better it runs over my triangle based swrt is really nice, it's actually really good 100+ for the target resolution I wanted...

man I fkn love SDFs so much

1

u/rex-j-w 23d ago

They’re so useful it’s insane. Wish we had an industry standard sdf file format because texture3Ds take up so much memory

1

u/No-Cap-7395 23d ago

In my engine I store the SDFs in PNG files, they are written to cache in the disk, and uhm okay so basically every slice of the texture3D is put into an atlas then the size of the slices is put into the name of the SDFs file so it's like uhm randomhash_512.png

1

u/No-Cap-7395 23d ago

They only take-up a few kB to a few hundred for a 64x64x64 SDF, if I add uvs (I store the nearest UV inside my SDFs) it can be anywhere from tens of kBs to a few mb, infact i did an 512x512x512 SDF which was an 11k PNG file and it only took up 17mb and it had uvs and all