enzyme69 / blendersushi

Blender Sushi related scripts. Mostly about Sverchok, Geometry Nodes, Animation Nodes, and related Python scripts.
244 stars 33 forks source link

EXPERIMENTAL / SV, SDF, Volume and PyMCubes again (Marching Cubes related) #482

Open enzyme69 opened 6 years ago

enzyme69 commented 6 years ago

http://jamie-wong.com/2016/07/15/ray-marching-signed-distance-functions/

pymcubes.zip

I am using Blender 2.79 with Python 3.7, this is important, and seems to work ok if we simply copy paste the mcubes module folder into Blender.

enzyme69 commented 6 years ago

Man this thing is complex, but also interesting: https://www.alanzucconi.com/2016/07/01/signed-distance-functions/

enzyme69 commented 6 years ago

And... Inigo Quilez: http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm

enzyme69 commented 6 years ago

Sphere

float sdSphere( vec3 p, float s ) { return length(p)-s; }

def sphere(x,y,z): res = math.sqrt(xx + yy + z*z) - 1 return res

Above function does the same. So we are basically piping P or position XYZ. The result can become volume or surface of volume, in this case is sphere. length(P) is distance XYZ.

All this is pretty weird.

enzyme69 commented 6 years ago

Torus

float sdTorus( vec3 p, vec2 t ) { return length( vec2(length(p.xz)-t.x,p.y) )-t.y; }

Create the volume

def f(x, y, z):

# (sqrt(x*x+y*y)-3)^2+z*z-1 formula from MathMod
res=(math.sqrt(x*x+y*y)-r_i)**2+z*z-r_o

return res
enzyme69 commented 6 years ago

Sphere + Displace Volume:

def sphere(x,y,z): res = math.sqrt(xx + yy + z*z) - r_a return res

def displace(x,y,z): res = math.sin(blahx)math.sin(blahy)math.sin(blah*z)
return res

def sphereDisplaced(x,y,z): return sphere(x,y,z) + displace(x,y,z)

screen shot 2018-10-05 at 17 23 16
enzyme69 commented 6 years ago
screen shot 2018-10-05 at 17 42 43

https://blender.stackexchange.com/questions/100125/procedural-volumetric-texture-generated-from-a-script

osl_study_volume_002.blend.zip

OSL and Cycles Volume ...

enzyme69 commented 6 years ago

https://www.boristhebrave.com/2018/04/15/marching-cubes-3d-tutorial/

This also explain the concept on "Marching Cubes"

enzyme69 commented 6 years ago

Searching for a way to generate Mandelbulb and Fractal 3D mesh... https://github.com/buddhi1980/mandelbulber2 http://bugman123.com/Hypercomplex/

I reckon that this thing is maybe a bit too fast too complex but interesting nevertheless..

enzyme69 commented 6 years ago

http://scikit-image.org/docs/0.14.x/auto_examples/edges/plot_marching_cubes.html

enzyme69 commented 6 years ago

Cycles: http://mattlindley.me/2016/01/03/blender-mandelbulb/

And also this one from recent: (Eeevee) https://www.youtube.com/watch?v=YtDG1_76_2k

enzyme69 commented 6 years ago

Watch also this: https://www.youtube.com/watch?v=u9KNtnCZDMI