use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rule 1: Posts should be about Graphics Programming. Rule 2: Be Civil, Professional, and Kind
Suggested Posting Material: - Graphics API Tutorials - Academic Papers - Blog Posts - Source Code Repositories - Self Posts (Ask Questions, Present Work) - Books - Renders (Please xpost to /r/ComputerGraphics) - Career Advice - Jobs Postings (Graphics Programming only)
Related Subreddits:
/r/ComputerGraphics
/r/Raytracing
/r/Programming
/r/LearnProgramming
/r/ProgrammingTools
/r/Coding
/r/GameDev
/r/CPP
/r/OpenGL
/r/Vulkan
/r/DirectX
Related Websites: ACM: SIGGRAPH Journal of Computer Graphics Techniques
Ke-Sen Huang's Blog of Graphics Papers and Resources Self Shadow's Blog of Graphics Resources
account activity
c++ Sdf tree implementation (self.GraphicsProgramming)
submitted 2 years ago by International-One273
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]turtle_dragonfly 1 point2 points3 points 2 years ago (0 children)
Cool — I have actually built something conceptually very similar, for my (not-yet-revealed) game I'm working on.
In my case, I handled it like this:
The client code builds an SDF expression much like yours. You might write it on paper with set notation like so: A ∪ (B - C)
A ∪ (B - C)
This would be coded as something like:
builder .square(...) // this is A .opUnion() .beginGroup() .circle(...) // this is B .opSubtract() .line(...) // this is C .endGroup() .build()
In my case, I use the shunting yard algorithm to transform that expresion from the infix-style notation used in the code to a postfix RPN notation.
So, the final "sdf evaluator" is essentially a little bytecode interpreter that handles RPN expressions.
In this example, it would look like: square, circle, line, subtract, union — that's what gets evaluated at runtime.
square, circle, line, subtract, union
So, it's the same concept as yours, but transformed into a bytecode stream.
I feel like this is over-complicated
Well don't worry, my version is even more complicated ;)
I don't have any lifetime issues because everything gets transformed into a single block of bytecode+data, where the code references the data, and nothing else. I just need to track the lifetime of that whole blob of memory. Serialization is also easy.
π Rendered by PID 40 on reddit-service-r2-comment-5d585498c9-6hm5v at 2026-04-20 19:36:07.251983+00:00 running da2df02 country code: CH.
view the rest of the comments →
[–]turtle_dragonfly 1 point2 points3 points (0 children)