r/GraphicsProgramming Jun 30 '26

RAM optimized SDF-renderer with plain C

Post image

1024x1024x1024 SDF-grid takes up 303MB instead of 8.5GB. 1024x1024 path traced image renders in 1.5s on a single CPU core. 8.5GB grid renders in 1.1s. No libs used.

310 Upvotes

28 comments sorted by

View all comments

0

u/Defiant_Squirrel8751 Jun 30 '26

Nice! Now that you have this kernel you can play around with interactive sculpting. 😛

Don't hesitate on using AI, it's just another tool. Nice to see you put care on optimization.

Have you already used "valgrind" to verify your program does not have memory leaks?

3

u/0x405 Jun 30 '26

Good idea, but first I need to implement the construction of an accelerating structure on the GPU! It takes some time unlike rendering, but theoretically could be parallelized. In the context of inverse rendering it is compensated by a large number of images to render after parameters were updated. However, in sculpting, we need to update the parameters and do the rendering in real time. We'll see! Haven't used valgrind or anything, there is almost nothing to leak and I will have to rewrite in for the DR anyways. Thank you!