4 ms·
Good idea, I'll add a reference to SDFs. Didn't think about the normal-via-autodiff aspect, which would be quite useful. It seems to me that SDFs are very hard
by unixpickle 7y ago
Good idea, I'll add a reference to SDFs. Didn't think about the normal-via-autodiff aspect, which would be quite useful.
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.
- GistNoesis 7y agoAs a intermediate solution between boolean and SDFs, you can also use some implicit representation defined by a neural network. It could be marched by your current algorithm. 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.
- unixpickle 7y agoA 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.