Show HN: Render Arbitrary 3D Boolean Functions
aqnichol.com
aqnichol.com
It's easy to define very interesting 3D models as boolean functions. In my opinion, it's much easier than creating triangle meshes or composing a bunch of primitive shapes. I had fun making the examples, and I'm curious to see what other people can come up with.
It seems to me that SDFs are very hard to program from scratch, compared to simple boolean functions. Obviously they are easy to implement for compositions of simple shapes, but for things like my text example (and maybe the corkscrew example, although of course that is still a fairly simple mathematical shape), it's less obvious how to implement an SDF by hand.
And you can train the neural network with your mathematical boolean function by sampling the space to provide positive and negative samples.
With the neural network representation, you can also build your mesh by iteratively picking points and specifying whether they are in or outs. Or you can specify the distance or the normal. They are much more flexible. They can even do the rendering.
Various representations are always useful to have so you can pick the right one for your current problem.
If you sample the boolean function enough to train a neural network on it, you've likely sampled more than enough to build a very accurate mesh using marching cubes or other algorithms. Meshes are especially easy to render, plus they can tell you quite a lot.