Logo by Pauldelbrot - 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: Visit the official fractalforums.com Youtube Channel
 
*
Welcome, Guest. Please login or register. February 17, 2020, 01:49:59 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: Kaliset 3D fractal used as coloring & texture for DE systems  (Read 4634 times)
Description: Implemented with Syntopia's Fragmentarium
0 Members and 1 Guest are viewing this topic.
Kali
Fractal Supremo
*****
Posts: 1138


« on: July 10, 2012, 04:47:48 AM »

Hi, I'm making this post to give some details of the technique I used for this images I posted to the gallery:



It's quite simple, no need of surface mapping or working with normals, as you will see.

To show how it works, I will use a DE system that renders a 3D model of a wagon that carries steels bars in the factory I work in. Why I did this model? Because I was talking about fractals with a co-worker that was interested in my works (he saw them on my Facebook), and he challenged me to make a fractal out of this wagon we have in our sector (as a sidenote, I work as an operator of a magnetic crane that loads this wagon with steel bars, among other tasks, and this bars are carried by rail to another sector and later used for making seamless tubes).

This is the plain rendering of the wagon (I used a DE combinate of simple geometric shapes to do it):



And the fractal one I did for my friend smiley :



First of all, what is a 3D Kaliset? Kaliset is the name I put to a simple formula I discovered to produce fractal patterns, much like the ones that Sam Monnier's "Ducks" formula produces, but Kaliset is extendable to any dimension.

The 3D version of it is difficult to represent, I will not discuss the reasons here, but you can check the original thread of the Kaliset formula: http://www.fractalforums.com/new-theories-and-research/very-simple-formula-for-fractal-patterns/

As the 2D version representation, using inside coloring methods, is a fractal that fills the plane with patterns, the same procedure applied to a 3D version fills the space with them too. But how to make them visible? only with slice cuts of the space, or... as distortions of the space itself that will change the shape of anything you draw on it. Also it can be used for coloring the surface of any shape or fractal.

This is the Kaliset sub-routine I made for Fragmentarium:

Code:
float Kaliset(vec3 pos) {
vec3 p = pos*Zoom+Offset;  // Zoom and Offset values set the scale and relative position of the Kaliset fractal
int i=0;
float ln=0;
float lnprev=0;
float expsmooth=0;
for (i=0; i<Iterations; i++) {
                // Kaliset formula (Scale and Julia are the params):
p=abs(p);
p=p/dot(p,p); // means that the vector is divided by the square of it's length (inversion)
p=p*Scale+Julia;
                // Exp. smoothing calculation:
lnprev=ln;
ln=length(p);
expsmooth+=exp(-1/abs(lnprev-ln));
}
return expsmooth;
}

This will return a value computed by the exponential smoothing calculation of the values at each formula iteration for the 3D point defined on the vec3 parameter.

Let's call this value "k":

Code:
float k=Kaliset(p);

This value can be directly used for coloring. In Fragmentarium, I assign this value to the orbitTrap variable that is used by the default renderer for coloring:

Code:
orbitTrap=vec4(1,1,1,1)*(k*ColorScale+ColorOffset); // ColorScale and ColorOffset are used for color density and color shifting adjustments

(Note: For best results I must set "CycleColors" on, with some cycles added.)

Then, what I did is scaling the 3D vector currently being used in the distance estimator, in this way:

Code:
float sc=1+k*Strength // Strength is a factor to control the amount of distortion (usually very small value);
p*=sc // p is the vector we are working with on the DE system;

Then use "p" for any DE system you want, a fractal or whatever... but the result must be divided by "sc":

Code:
float d=length(p)-1; //DE for a sphere
return d/sc;

Let's see how it works with my wagon model...

Only coloring:




Only distortions:




Combination of both:






As for the distortions, this is the simplest way I found at first, but I'll try to find another method because the distortions are not equally distributed; they increase the more far the fractal is of the axis origin, as the obvious result of the scaling operation
(notice the top faces of the wagon are little affected because they are near z=0, and no effect on the floor that it's indeed on z=0)

Also another formulas could be used for this, the only rule is that it must produce patterns in all directions on space.

I hope my explanation was clear enough, maybe someone could find this useful/interesting so I wanted to share it.
Any comments or suggestions for improving this procedure will be very welcomed.

« Last Edit: July 10, 2012, 07:15:05 AM by Kali » Logged

|</\|_|
░░░░░░░

http://fractkali.deviantart.com/
Kali
Fractal Supremo
*****
Posts: 1138


« Reply #1 on: July 10, 2012, 05:40:02 AM »

Quote
As for the distortions, this is the simplest way I found at first, but I'll try to find another method because the distortions are not equally distributed; they increase the more far the fractal is of the axis origin, as the obvious result of the scaling operation
(notice the top faces of the wagon are little affected because they are near z=0, and no effect on the floor that it's indeed on z=0)

I've noticed that adding or substracting the k value to the vector, instead of scaling it, works fine and this issue is resolved:

Code:
float sc=k*Strength;
p+=vec3(sc,sc,sc);

I thought this was not going to work well with the DE, but it does. There are sometimes undesired effects with big slopes and too busy patterns, using fudgefactor adjustment helps, but with low distortion strength and reducing iterations, it works just fine.

A sample image, with corrosion and rust/mold smiley





« Last Edit: July 10, 2012, 06:36:04 AM by Kali » Logged

|</\|_|
░░░░░░░

http://fractkali.deviantart.com/
Syntopia
Fractal Molossus
**
Posts: 681



syntopiadk
WWW
« Reply #2 on: July 10, 2012, 08:44:49 AM »

Great work, Kali!

I have done something similar to create textures on a couple of my own images: for instance I added some Perlin noise to the DE here: http://www.flickr.com/photos/syntopia/6791720035/in/photostream

And I've also done some tests using fractals as displacement maps: http://www.flickr.com/photos/syntopia/6854195470/in/photostream

A few comments - if the coloring function is heavy to calculate you may want to set the 'providesColor' flag, and implement a function for calculating color:

Code:
#define providesColor
#include "DE-Raytracer.frag"

vec3 baseColor(vec3 p, vec3 n) {
// calculate color based on position and surface normal
// (Don't calculate lighting here)
}

(In earlier versions of Fragmentarium, you must implement a function called 'vec3 color(vec3 p);' instead)

By doing this, you do not need to evaluate the coloring function at each ray step - only when the hit point has been calculated. Notice that 'OrbitStrength' must be set to 1.0, since it is stil used to mix in this baseColor.

Also, when doing surface displacements, the perturbations to the surface must always be small (otherwise you get artifacts) - this means you can ignore the displacement calculation, until the DE is less then a given treshold. I've tried this, but it was less of an optimization than I expected.

Logged
subblue
Conqueror
*******
Posts: 116



WWW
« Reply #3 on: July 10, 2012, 10:23:24 AM »

Very nice results, and excellent quality displacements too!
I take it you are running the Kaliset sub-routine at every ray marching step and not just at the end?

A while ago I did a few experiments with procedural displacements on top of the DE calculation with my WebGL stuff, but found I quickly reached the shader instruction limits as the complexity increased too much, even if the displacements were left to the end of the ray marching instead of at every step. For the moment I'm just using traditional bump mapping, but after seeing your results I might have to give it another shot smiley
Logged

www.subblue.com - a blog exploring mathematical and generative graphics
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #4 on: July 10, 2012, 10:29:19 AM »

that generic rusty surface is way cool, but a bit too strong on some images, dont you need many DE Combinates to create such a wagon ?! or are you just using 5 formulas combined to produce the waggon ?!?!?!
Logged

---

divide and conquer - iterate and rule - chaos is No random!
PhotoComix
Strange Attractor
***
Posts: 276


« Reply #5 on: July 10, 2012, 04:41:55 PM »

I could not follow well the technical part but i am very impressed by the examples.

A pity that i don't understand if in practice is something possible to do with the 3d programs discussed in this board (i.e. M3D or mandelbulb )

Logged
eiffie
Guest
« Reply #6 on: July 10, 2012, 04:52:19 PM »

Very cool Kali. Hey I had the same job once upon a time!
Logged
Kali
Fractal Supremo
*****
Posts: 1138


« Reply #7 on: July 10, 2012, 05:26:35 PM »

Thanks to all for the comments.

@Syntopia: many thanks for the info, I knew I was doing extra calculations (coloring the empty space smiley) but I didn't know how to optimize without changing the raytracer code.
As for the surface displacements, seems to work right even with not so small perturbances, look at this: http://www.fractalforums.com/index.php?action=gallery;sa=view;id=12056

@Subblue: Yes, I'm running it at every marching step... it works quite fast anyway on my GPU (Radeon 6870) - I will try doing it at the end of the raymarching, but... I don't know, just guessing but I think it will not work the same when doing displacements...

@Chris: The strongness of the surface effect can be easily adjusted, and also depends on the fractal params and iterations used.
Each segment of the wagon is made up of 22 formulas, then repeated x 3. But consider that DE formulas used are very simple.

@PhotoComix: This is Fragmentarium, sorry... but ask the author of your favourite 3D fractal program to implement this feature grin

@eiffie: Really?? I've only recently become a crane operator, less than a year experience.
I did mostly office and computer work for the last 14 years before, so what a change, don't you think? grin
« Last Edit: July 10, 2012, 05:36:12 PM by Kali » Logged

|</\|_|
░░░░░░░

http://fractkali.deviantart.com/
tit_toinou
Iterator
*
Posts: 192


« Reply #8 on: November 07, 2012, 12:50:52 PM »

The images below "Only distortions" and "Combination of both" are F*CK*NG AWESOME.
Logged

Crist-JRoger
Fractal Fertilizer
*****
Posts: 389



WWW
« Reply #9 on: September 08, 2015, 09:11:16 PM »

Hi!
How add surface mapping only for "floor" in DE-Raytracer?
Logged

Crist-JRoger
Fractal Fertilizer
*****
Posts: 389



WWW
« Reply #10 on: September 11, 2015, 06:13:09 PM »

So, i`m still not a programmer... just made my own surface and added it to mandelbulb

Logged

mclarekin
Fractal Senior
******
Posts: 1739



« Reply #11 on: September 12, 2015, 04:04:44 AM »

Nice image.  Im still not a programmer too, but this coding stuff still really interests me, so one day maybe I will understand it : smiley
Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #12 on: September 12, 2015, 03:18:25 PM »

So, i`m still not a programmer... just made my own surface and added it to mandelbulb

<Quoted Image Removed>

you seem to get a good grasp wink nice picture, and seeing it in motion is always nice
Logged

---

divide and conquer - iterate and rule - chaos is No random!
Crist-JRoger
Fractal Fertilizer
*****
Posts: 389



WWW
« Reply #13 on: September 13, 2015, 04:42:24 PM »

Thank you!
Another parameters. 10K render. Renderer with this parameters in attached archive. Maybe somebody will do something new with this...


* frag-13.09-1.bmp Files.zip (18.47 KB - downloaded 175 times.)
Logged

3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« Reply #14 on: September 13, 2015, 07:38:40 PM »

really nice work! may I include this in the Fragmentarium-1.0.11 dist?
Logged

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
Pages: [1] 2   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Auto Log Fractal coloring Help & Support fractalwizz 13 2587 Last post January 05, 2009, 11:56:37 PM
by HPDZ
Kaliset + boxfold = Nice new 2D / 3D fractal Amazing Box, Amazing Surf and variations « 1 2 3 » Kali 34 3888 Last post July 05, 2011, 03:32:30 PM
by Kali
Basic 3D Fractal Coloring Programming asimes 8 3764 Last post March 07, 2012, 10:03:22 AM
by cKleinhuis
Kaliset coloring and texture feature request PhotoComix 2 693 Last post July 21, 2012, 10:01:49 PM
by PhotoComix
texture and displace the floor using the Kaliset Fragmentarium « 1 2 » tryptophan 28 3076 Last post November 03, 2015, 01:50:49 AM
by Patryk Kizny

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.173 seconds with 28 queries. (Pretty URLs adds 0.014s, 2q)