Open enzyme69 opened 6 years ago
Man this thing is complex, but also interesting: https://www.alanzucconi.com/2016/07/01/signed-distance-functions/
And... Inigo Quilez: http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm
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.
float sdTorus( vec3 p, vec2 t ) { return length( vec2(length(p.xz)-t.x,p.y) )-t.y; }
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
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)
https://www.boristhebrave.com/2018/04/15/marching-cubes-3d-tutorial/
This also explain the concept on "Marching Cubes"
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..
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
Watch also this: https://www.youtube.com/watch?v=u9KNtnCZDMI
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.