Welcome to Fractal Forums

Fractal Math, Chaos Theory & Research => General Discussion => Topic started by: DarkBeam on November 10, 2016, 10:50:55 PM




Title: Minimal surfaces are beautiful
Post by: DarkBeam on November 10, 2016, 10:50:55 PM
Some of my favourites:
http://demonstrations.wolfram.com/EnneperSurface/
http://demonstrations.wolfram.com/LopezMinimalKleinBottle/
http://demonstrations.wolfram.com/ViewsOfTheCostaMinimalSurface/

Ennepers is the simplest of them.
I tried to think a way to plot it in a non parametric way... Never found an answer!
Anyone is able to write an a Ennepers 3d in Shadertoy? :)
https://vimeo.com/106575488


Title: Re: Minimal surfaces are beautiful
Post by: DarkBeam on November 18, 2016, 03:24:40 PM
I always wanted to render this cool surface that apparently has a very simple ready to use equation.
(from Wikipedia)
Scherk's second surface looks globally like two orthogonal planes whose intersection consists of a sequence of tunnels in alternating directions. Its intersections with horizontal planes consists of alternating hyperbolas.

It has implicit equation:

(https://wikimedia.org/api/rest_v1/media/math/render/svg/01a4d8c7d378d82c814fedc09cc8b40625fa1d82)

Too bad for me, sinh() is a function that grows exponentially but raytracers need linear distance fields to render correctly. Also it's sign is not constantly positive.
But we can always do some math tricks. Let's see.
Sinh(a) = (exp(2*a)-1)/(2*exp(a))

If we replace, and bring the denominator to the left of the previous expression; ;D

4*exp(x+y)*sin(z) = exp(2*(x+y)) - exp(2*x) - exp(2*y) +1;
If we call 4*exp(x+y)*sin(z) = J, and eliminate negative signs, we have;
J + exp(2*x) + exp(2*y) = exp(2*(x+y)) +1;
Now it is a nice expression. Exp is always >= 0, so both terms have an expression that's always >= 0 except J. Log() can linearize an exponential field only if both equation terms are strictly > 0.
But nobody forbids to make a little cheat later on it. Supposing J>0, if we take logarithm on both terms we have log(N) = log(D), that equals to
log(N)-log(D)=0,
or log(N/D)=0 (implicit surface expression), that always gives us real values if both N and D are >= 0.
Using this routine we can get a linear field that plots a Scherk;

Code:
float ScherkDe(float x, float y, float z)
 {
  float Ex=exp(x); float Ey=exp(y); float zz=Ex*Ey;
  float N = Ex*Ex+Ey*Ey;
  float D = 1+zz*zz;
  zz = 4.*sin(z)*zz; // can be + or - or change 4 to get elliptic holes
  if (zz>0) N += zz else D -= zz; // we bring it to the correct eq side :)
  return abs(log(N/D))-.05; // give it a little thickness so it renders better
}
The surface as is it's boring but you can do variations ;)
A cool one is
ScherkDe(k*sin(x), k*sin(y), z)/k;
Or try to do complex transform on x and y to create effects.
This gallery shows a lot of those lovely surfaces: (not much is clear though)
https://wewanttolearn.wordpress.com/2015/11/11/scherks-minimal-surface/


Title: Re: Minimal surfaces are beautiful
Post by: KRAFTWERK on November 18, 2016, 08:39:58 PM
Cool DB, but where is the M3D formula?  O0


Title: Re: Minimal surfaces are beautiful
Post by: DarkBeam on November 18, 2016, 10:06:09 PM
Cool DB, but where is the M3D formula?  O0

Lol Johan, stuck on my pc still because I need to tune it a little :troll: u mad?


Title: Re: Minimal surfaces are beautiful
Post by: woronoi on November 18, 2016, 10:23:27 PM
(https://img-fotki.yandex.ru/get/195561/97637398.e/0_e52f3_e349ddf6_orig.jpg)

https://www.shadertoy.com/view/4tcXDN




Title: Re: Minimal surfaces are beautiful
Post by: DarkBeam on November 18, 2016, 11:15:36 PM
 Beautiful shader! The de is imperfect as it shows in the 3d navi into mb3d. Idk if it is fixable in some way. (The final renders are perfect btw.) Thanks. :beer:
But you spoiled the surprise a little  O0


Title: Re: Minimal surfaces are beautiful
Post by: woronoi on November 19, 2016, 06:38:04 AM
But you spoiled the surprise a little

I'm surprised too. It's working!


Title: Re: Minimal surfaces are beautiful
Post by: KRAFTWERK on November 19, 2016, 09:41:45 AM
Lol Johan, stuck on my pc still because I need to tune it a little :troll: u mad?

No problem Luca ;D , I can wait!  O0


Title: Re: Minimal surfaces are beautiful
Post by: DarkBeam on November 21, 2016, 06:40:09 PM
An attempt to replicate those pics;
http://numod.ins.uni-bonn.de/grape/EXAMPLES/AMANDUS/ktower.html
Except it actually uses another method that I didn't understand.
I used a lame one :embarrass:
(the correct one may be a simple mirroring)
I used a complex power but preserving intact the magnitude, that can give some trouble for higher powers; visualize this w EvalDraw

Code:
(x,y) //press F1 for help
z=mousx/10;
t=atan2(y,x); u=sqrt(x*x+y*y); // complex power (unoptimized but general)
t=3/2*t; // complex power (replace 3 with any integer to get pretty stars)
x=sin(t)*u; // complex power
y=cos(t)*u; // complex power
ex=exp(x);
ey=exp(y);
zz=ex*ey;
n=ex*ex+ey*ey;
d=1+zz*zz;
zz=4*sin(z)*zz;
if (zz>0) n=n+zz; else d=d-zz;
return log(n/d);

//press ALT/ESC for menu


Title: Re: Minimal surfaces are beautiful
Post by: woronoi on November 21, 2016, 09:21:46 PM
https://www.shadertoy.com/view/lldSWN


Title: Re: Minimal surfaces are beautiful
Post by: Sabine on November 21, 2016, 09:33:16 PM
@woronoi The most beautiful 'swiss cheese"!  :beer:


Title: Re: Minimal surfaces are beautiful
Post by: DarkBeam on November 21, 2016, 10:27:13 PM
I am seeing a bad de woronoi so keeping into account a power of 3 I think this should be better (still shows some sand in the center):

return (.1666667*abs(log(n/d))-0.01); // not sure about 0.01 maybe higher or lower

Thanks for testing those foolish routines of mine tho :D