Re:Show HN: Render Arbitrary 3D Boolean Functions
by unixpickle on Monday February 17, 2020 @05:18PM
(#22351413)
A neural network would have some nice properties for sure, although it'd also have plenty of bad ones. For one thing, I'd guess that the NN wouldn't be great for rendering in real-time, since it's liable to be orders of magnitude slower than the JS function it's approximating. Granted you could use a GPU--but then again, you could probably compile the JS function into a kernel and get a speedup there too.
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.
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.