This patch explores the use of jit.gen to generate 3D matricies for use with jit.gl.isosurf. I've always had a soft spot for blobby, amorphous shapes, (http://en.wikipedia.org/wiki/Isosurface), but they tend to be hard to wrangle.
I ran across a web site (http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm) that has a handful of distance functions for some basic object primitives (sphere, torus, cone, etc), as well as some really cool distance and domain deformations.
The attached patch basically takes two primitives (cube and sphere) and throws them into the same data set, to create a morphing blobular shape, where the sphere is trying to “escape” from the grips of the cube. I wanted to keep it simple so you can see what is going on.
Since I put this patch together, I've gone ahead and implemented some of the other functions on the page. Can you? I particularly like the displacement deformation function.
jit.gl.isosurface is a touchy object, but once you find the right settings, you can get some really nice results. For me, jit.gen is a more immediate way to interact with the type of data sets that jit.gl.isosurface needs to compute the 3D object. Its really fun to just start throwing in different operators to see how they affect the outgoing matrix.
Feb 7, 2012 at 5:11pm #218949