making a cube with jit.gl.isosurf/jit.expr

strimbob's icon

Hello all

I being use a old nesa patch metaballs, but i what to make a cube in jit.gl.isosurf, and not a sphere

the sphere is being generated from maths in jit.expr, can show me how to make a cube from it instead or give me some points?

Max Patch
Copy patch and select New From Clipboard in Max.

thanks Ben

strimbob's icon

sorry, i've re-read my post and it did not make lots of sense here was the question:

I've been using an old Nesa patch, Metaballs, and I want to make a cube in jit.gl.isosurf, not a sphere.

The sphere is being generated from maths in jit.expr. Can someone show me how to make a cube from it instead, or give me some pointers?

thanks Ben

-- Pasted Max 5 Patch, click to expand. --

Wesley Smith's icon

A cube is trickier. You'll need to come up with a distance function for a cube. Have a look at this page:
http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm

strimbob's icon

thanks for the answer, however i am struggling to understand how to implement the code from the page into jit.expr,
do i understand this right?
for making a cube in jit.gl.isosurf you would use a multi plane image with the xy being on the same plane and the z would be the plane number
any more help would be fab!

thanks
Ben

Wesley Smith's icon
Max Patch
Copy patch and select New From Clipboard in Max.

It'll be tricky to do with jit.expr because you need a length function. With jit.gen it's trivial:

strimbob's icon

wow thank you!! i am excited