Title: Kaliset 3D fractal used as coloring & texture for DE systems Post by: Kali 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:
(http://nocache-nocookies.digitalgott.com/gallery/12/thumb_3869_09_07_12_8_28_27.jpeg) (http://nocache-nocookies.digitalgott.com/gallery/12/thumb_3869_09_07_12_8_16_06.jpeg) (http://nocache-nocookies.digitalgott.com/gallery/12/thumb_3869_03_07_12_6_20_32.jpeg) 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): (https://dl.dropbox.com/s/00crxpotkizrlgh/zorraplain.jpg) And the fractal one I did for my friend :) : (https://dl.dropbox.com/s/up4th58l9lmekrr/piramidedezorras.jpg) 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) {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); 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 Let's see how it works with my wagon model... Only coloring: (https://dl.dropbox.com/s/dnapxu2zhtrxrka/zorracolored.jpg) Only distortions: (https://dl.dropbox.com/s/pimfam9tonbehxa/zorrabumponly.jpg?dl=1) Combination of both: (https://dl.dropbox.com/s/j0c0fap0j6mb73v/zorrarusty.jpg) (https://dl.dropbox.com/s/8pr3tse1s2hyz8f/zorrabump.jpg) 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. Title: Re: Kaliset 3D fractal used as coloring & texture for DE systems Post by: Kali 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; 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 :) (https://dl.dropbox.com/s/xlzag7u45ijjkt2/zorramoho.jpg) Title: Re: Kaliset 3D fractal used as coloring & texture for DE systems Post by: Syntopia 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 (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. Title: Re: Kaliset 3D fractal used as coloring & texture for DE systems Post by: subblue 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 :) Title: Re: Kaliset 3D fractal used as coloring & texture for DE systems Post by: cKleinhuis 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 ?!?!?!
Title: Re: Kaliset 3D fractal used as coloring & texture for DE systems Post by: PhotoComix 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 ) Title: Re: Kaliset 3D fractal used as coloring & texture for DE systems Post by: eiffie on July 10, 2012, 04:52:19 PM Very cool Kali. Hey I had the same job once upon a time!
Title: Re: Kaliset 3D fractal used as coloring & texture for DE systems Post by: Kali 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 :)) 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 ;D @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? ;D Title: Re: Kaliset 3D fractal used as coloring & texture for DE systems Post by: tit_toinou on November 07, 2012, 12:50:52 PM The images below "Only distortions" and "Combination of both" are F*CK*NG AWESOME.
Title: Re: Kaliset 3D fractal used as coloring & texture for DE systems Post by: Crist-JRoger on September 08, 2015, 09:11:16 PM Hi!
How add surface mapping only for "floor" in DE-Raytracer? Title: Re: Kaliset 3D fractal used as coloring & texture for DE systems Post by: Crist-JRoger 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
(http://orig03.deviantart.net/7422/f/2015/254/1/3/frag_10_09_2_by_crist_jroger-d996it9.jpg) Title: Re: Kaliset 3D fractal used as coloring & texture for DE systems Post by: mclarekin 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 : :)
Title: Re: Kaliset 3D fractal used as coloring & texture for DE systems Post by: cKleinhuis 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 (http://orig03.deviantart.net/7422/f/2015/254/1/3/frag_10_09_2_by_crist_jroger-d996it9.jpg) you seem to get a good grasp ;) nice picture, and seeing it in motion is always nice Title: Re: Kaliset 3D fractal used as coloring & texture for DE systems Post by: Crist-JRoger 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... (http://pre02.deviantart.net/e66d/th/pre/f/2015/256/f/0/sunrise_by_crist_jroger-d99fgem.jpg) (http://orig12.deviantart.net/0a1d/f/2015/256/f/0/sunrise_by_crist_jroger-d99fgem.jpg) Title: Re: Kaliset 3D fractal used as coloring & texture for DE systems Post by: 3dickulus on September 13, 2015, 07:38:40 PM really nice work! may I include this in the Fragmentarium-1.0.11 dist?
Title: Re: Kaliset 3D fractal used as coloring & texture for DE systems Post by: Crist-JRoger on September 14, 2015, 01:53:31 PM Yes you can.
But this is test. It's not a workable renderer. Maybe somebody who knows a little glsl... will help to make surface as part of raytracer like floor. Title: Re: Kaliset 3D fractal used as coloring & texture for DE systems Post by: 3dickulus on September 14, 2015, 02:47:09 PM Ty :) I will watch this and place under "Experimental" for now :beer:
edit:perhaps more appropriate under "Kali's Creations" with a comment pointing to this thread, and mentioning your mod CJR, if that's ok Kali? edit:edit: http://www.fractalforums.com/fragmentarium/texture-and-displace-the-floor-using-the-kaliset/ Title: Re: Kaliset 3D fractal used as coloring & texture for DE systems Post by: Crist-JRoger on September 14, 2015, 03:57:37 PM Ha-ha :D I didn't saw this. Thank you! |