Logo by Maya - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Check out the originating "3d Mandelbulb" thread here
 
*
Welcome, Guest. Please login or register. March 28, 2024, 10:48:24 AM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1] 2   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: Fractal + Change of domain mashup  (Read 5109 times)
0 Members and 1 Guest are viewing this topic.
Roquen
Iterator
*
Posts: 180


« on: August 28, 2013, 05:24:04 PM »

First pass at a simple example of using domain distortion with a fractal.  Standard m-set fractal where c = T(s) and 's' is input in the sampling domain.  The single transform is this:

T(s) = (1/s) + k

which maps a fixed point 'k' to infinity.  The presets which match images commonly seen are: "Cusp", "Origin" and "Needle".

(NOTE: The actual transform in the code is: s/dot(s,s)+k which is eqv. due to the sym about the x-axis)

* MSetInvert.frag (8.14 KB - downloaded 271 times.)
« Last Edit: August 28, 2013, 05:26:06 PM by Roquen » Logged

All code submitted by me is in the public domain. (http://unlicense.org/)
3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« Reply #1 on: August 29, 2013, 11:10:20 AM »

The first thing I wondered while looking at a fractal using your "domain mashup" was : Very nice! will it apply to a 3D fractal like a mandelbulb?...

It does ?



Code:
vec3 domainMap(vec3 c)
{
  float s = dot(c,c);
  return c/s;
}
called like...
Code:
z = domainMap(z);
right before the powN1 function in DE of mandelbulb.frag

Would this be a Roquen-bulb? or is that just plain 3Dickulus laugh
I just rendered a few preliminary shots but I think this object warrants some more exploration.


* domain-transform.jpg (65.84 KB, 656x566 - viewed 584 times.)
« Last Edit: August 30, 2013, 01:11:32 AM by 3dickulus, Reason: attachment » Logged

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
Roquen
Iterator
*
Posts: 180


« Reply #2 on: August 29, 2013, 11:29:33 AM »

I banged out my post quickly.  I mentioned application to all fractals in this post: http://www.fractalforums.com/index.php?topic=16887.msg64838#msg64838

So if the bulb formulation is using DE, you'd want to compare against a non-DE version so see if any undesirable defects are being introduced.  Change of domains is a very powerful technique IMHO.

Also I should note that the transform above is a tricky one in that it make larger changes of the visual domain and that the implementation blows chunks for precision. 
Logged

All code submitted by me is in the public domain. (http://unlicense.org/)
3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« Reply #3 on: August 29, 2013, 02:25:03 PM »

read that post, wow, my brain hurts, that's some pretty heady stuff, I'll have to read it one or two more times to let it soak in
http://www.fractalforums.com/index.php?action=gallery;sa=view;id=14769 a picture is worth a thousand... utterations smiley
Logged

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
Roquen
Iterator
*
Posts: 180


« Reply #4 on: August 29, 2013, 02:53:01 PM »

Thanks for tossing up some 3D examples.  I joined DeviantArt (http://roquendm.deviantart.com) and tossed up some example from the example code above, but don't see how embedded them in the post.

I'll try to toss a post together that might make more sense to more people.

Logged

All code submitted by me is in the public domain. (http://unlicense.org/)
3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« Reply #5 on: August 29, 2013, 04:29:27 PM »

The image in my gallery has a slight twist...
Added a float3 widget for invertC as in the 2D version and...
Code:
// coordinate to invert to infinity
uniform vec3 InvertC; slider[(-5,-5,-5),(0,0,0),(5,5,5)]

// performs the active c = T(s)
vec3 domainMap(vec3 c)
{
  float s = dot(c,c);
  return c/s + InvertC;
}
called as...
Code:
z += domainMap(-z);
...right after the Julia test  z+= JuliaC : pos
seemed to give the bulb more body less holes and then I got to fiddling with the parameters and, well, there you have it  smiley
another tool in the kit Thanks Roquen, I'm starting to enjoy playing with the GLSL side of Fragmentarium.
Logged

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
Roquen
Iterator
*
Posts: 180


« Reply #6 on: August 29, 2013, 05:02:23 PM »

Here's a quick example of me attempting to design a domain from scratch to achieve a specific result.  I just grabbed a raytracing routine which is used to map values in a unit square (from a pseudo or quasi random number generator) to a unit circle.  This has no basis in complex numbers...it's just an ad-hoc function.  Visually we'll see the opposite...we'll see circles being mapped to squares.  Here's the base code:

Code:
const float M_PI = 3.141592653589793238463;
const float M_PI_2 = (M_PI * 0.5);
const float M_PI_4 = (M_PI * 0.25);

// Map 'c' within unit square ([0,1],[0,1]) to a unit disk
vec2 toUnitDisk(vec2 c)
{
  c += c;

  float a = c.x - 1.0;
  float b = c.y - 1.0;
  float t,r;
 
  if (a*a > b*b) {
    r = a;
    t = M_PI_4*(b/a);
  } else {
    r = b;
    t = M_PI_2 - M_PI_4*(a/b);
  }
 
  return r*vec2(cos(t),sin(t));
}

vec2 zortho(vec2 a) { return vec2(-a.y, a.x); }

So I replaced the contents of domainMap with "return toUnitDisk(c);"  which ended up looking humanoid like, but turn sidewise.  So to place the "head" up I needed to rotate it in the visual domain, so I changed the code to this:

Code:
vec2 domainMap(vec2 c) { return toUnitDisk(zortho(c)); }

Which results in this image: http://roquendm.deviantart.com/art/Square1-396691344

There are no squares because we don't have any circles about the origin, so let's get a square.  There's a circle at (-1,0) so let's move that to the origin (from the function's perspective) and try again:

Code:
vec2 domainMap(vec2 c) { return toUnitDisk(c)-vec2(1.0,0.0); }

Which results in this image: http://roquendm.deviantart.com/art/Square2-396691523

Fun a square and a heart!  Of course the image is distorted due to the nature of the transform.  If I really cared I could try to come up with another transform to attempt to correct that.

Anyone that want to play around with this stuff, try looking at the domain plots I posted here: http://s824.photobucket.com/user/RoquenDM/library/DomainPlots?sort=9&page=1.

Examine the identity transform and some other transform and then use that other transform for your domain mapping function.

Also fragmentarium has an example: Experimental/LiftedDomainColoring.

While I'm at it the domain images were created with Mathematica with some code I lifted from somewhere, here it is:
Code:
complexGrid =
  Compile[{{max, _Real}, {n, _Integer}},
   Module[{r}, r = Range[-max, max, 2 max/(n - 1)];
    Outer[Plus, -I r, r]]];

complexHSB =
  Compile[{{Z, _Complex, 2}},
   Module[{h, s, b, b2}, h = 0.5 + Arg[Z]/(2 Pi);
    s = Abs[Sin[2 Pi Abs[Z]]];
    b = Abs[Sin[2 Pi Im[Z]] Sin[2 Pi Re[Z]]]^0.25;
    b2 = 0.5 ((1 - s) + b + Sqrt[(1 - s - b)^2 + 0.01]);
    Transpose[{h, Sqrt[s], b2}, {3, 1, 2}]]];

domainImage[func_, max_, n_] :=
  ImageResize[
   ColorConvert[
    Image[complexHSB@func@complexGrid[max, 2 n], ColorSpace -> "HSB"],
     "RGB"], n];

domainPlot[func_, max_: Pi, n_: 500] :=
  ContourPlot[0, {x, -max, max}, {y, -max, max}, Contours -> {},
   RotateLabel -> False,
   FrameLabel -> {"X", "Y", ToString@StandardForm@func@"z"},
   BaseStyle -> {FontFamily -> "Calibri", 14},
   Epilog ->
    Inset[domainImage[func, max, n], {0, 0}, {Center, Center},
     2` max]];

And usage examples:
Code:
domainPlot[# &] (* identity *)

F[z_] := Abs[Re[z]] + I Im[z]  (* the fold used in kaliset *)
domainPlot[F[#] &]

F[z_] = Sqrt[z*z]      (* note relation to the kaliset fold *)
domainPlot[F[#] &]

domainPlot[Sin]         (* zeroes along the x-axis yield one origin per zero, unless there's a constant added, in that case the constant will be the point of the base fractal mapped to the zero *)
Logged

All code submitted by me is in the public domain. (http://unlicense.org/)
Roquen
Iterator
*
Posts: 180


« Reply #7 on: August 29, 2013, 09:17:47 PM »

called as...
Code:
z += domainMap(-z);
This is awesome because recall that this first transform is suppose to be: T(s) = 1/s + k.  1/s = s*/dot(s,s) and I dropped the conjugate as an example of making use of a symmetry...specifically about the x-axis which makes the conjugate not needed.  Moving to 3D, then T(s) = 1/s + k = s*/dot(s,s) + k = -s/dot(s,s) + k.
Logged

All code submitted by me is in the public domain. (http://unlicense.org/)
3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« Reply #8 on: August 30, 2013, 12:15:52 AM »

Quote
This is awesome ...
I was playing with the idea of mapping the difference between current pos and the accumulated z coord ie:
Code:
z += domainMap(pos-z);
but again, that made for a very dense core with a majority of solutions beyond maxiter, holes.

You have some great images there, the domain plots are particularly interesting, I'm looking for a different color scheme than orbittrap, this might be helpful.
« Last Edit: August 30, 2013, 02:26:45 AM by 3dickulus, Reason: typo » Logged

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« Reply #9 on: August 30, 2013, 02:46:10 AM »

an image to illustrate the difference
LEFT pos-z RIGHT -z


* pos-z_vs_-z.jpg (37.62 KB, 660x296 - viewed 600 times.)
Logged

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« Reply #10 on: August 30, 2013, 03:12:17 AM »

and here we are plotting it for color as in...
Code:
if (i<ColorIterations) orbitTrap = min(orbitTrap, abs(vec4(domainMap(-z),r)));
...where r = length(z);

cool smiley


* domainMap-as-color.jpg (28.57 KB, 330x296 - viewed 761 times.)
Logged

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
Roquen
Iterator
*
Posts: 180


« Reply #11 on: September 06, 2013, 03:38:35 PM »

Little free time ATM.  Completed a hacky port of my example above to webgl: http://glsl.heroku.com/e#10873.3 for folks without fragmentarium.
« Last Edit: June 28, 2014, 03:20:19 PM by Roquen, Reason: update link to new version » Logged

All code submitted by me is in the public domain. (http://unlicense.org/)
Roquen
Iterator
*
Posts: 180


« Reply #12 on: September 10, 2013, 05:07:20 PM »

In a moment of work avoidance, I tossed a picture together which isn't one of the presets:

Logged

All code submitted by me is in the public domain. (http://unlicense.org/)
Nahee_Enterprises
World Renowned
Fractal Senior
******
Posts: 2250


use email to contact


nahee_enterprises Nahee.Enterprises NaheeEnterprise
WWW
« Reply #13 on: September 11, 2013, 04:20:07 AM »

    In a moment of work avoidance, I tossed a picture together which isn't one of the presets:

A couple of interesting areas in this image.     cheesy
 
Logged

Roquen
Iterator
*
Posts: 180


« Reply #14 on: September 12, 2013, 02:16:11 PM »

Fixed some bugs in the WebGL example: http://glslsandbox.com/e#10873.3
« Last Edit: February 19, 2016, 02:09:43 PM by Roquen » Logged

All code submitted by me is in the public domain. (http://unlicense.org/)
Pages: [1] 2   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
devianArt moderator adds a poll to see who wants the Fractal Gallery to change! Fractal News across the World Thunderwave 4 1219 Last post September 19, 2010, 08:20:10 AM
by Thunderwave
The Overseer's Domain Mandelbulb3D Gallery Don Whitaker 0 772 Last post March 18, 2011, 09:35:50 AM
by Don Whitaker
Magical Menger Mandelbulb Mashup Fragmentarium Gallery 3dickulus 1 727 Last post December 28, 2013, 04:03:46 AM
by SCORPION
Magical Menger Mandelbulb Mashup Animations Showcase (Rate My short Animation) 3dickulus 0 1357 Last post December 26, 2013, 03:19:41 AM
by 3dickulus
A discrete fractal for a change Still Frame - Wildstyle 0xbeefc0ffee 0 1684 Last post June 10, 2017, 03:10:20 AM
by 0xbeefc0ffee

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.455 seconds with 25 queries. (Pretty URLs adds 0.019s, 2q)