Welcome to Fractal Forums

Fractal Software => Programming => Topic started by: Mrz00m on September 22, 2013, 07:17:45 AM




Title: Please suggest a Formula to texture 3D worlds?
Post by: Mrz00m on September 22, 2013, 07:17:45 AM
copying nature is too difficult, however making a parallel worlds using size, scale and colour distributions of nature is easy, and makes fascinating synthetic worlds to explore. i.e. rather than make an actual insect in a computer, it's better to count how many mathematical patterns exist on the insect (eyes, wings, segments, hairs) the pattern sizes and how much of the insect they cover, and generate objects with the same number of patterns, in any order.

Anyways, I want to make a world texture generator for some games, what I am missing is a fractal generator adapted for textures, in shader programming. I would love something like the patterns showing in the picture, which are LastArc Lake-functions on a Julia set? except the code necessitates high zoom, high iteration and double precision numbers, and I would like similar code which is very fast and good at single precision computation of the graphics card. Any suggestions?

all suggestions and web referrals would be very welcome!

current simple CG shader code:

Code:
  half4 frag (v2f i) : COLOR
        {
            float2 p = i.uv;
 
            float time= _Time*4;
            float speed = 0.25;
            float3 color = float3(1.0f,0.5f,0.25f);
            float2 loc = float2(
                cos(time/4.0f*speed)/1.9f-cos(time/2.0f*speed)/3.8f,
                sin(time/4.0f*speed)/1.9f-sin(time/2.0f*speed)/3.8f
            );
            float depth;
 
            for(int i = 0; i < 40; i+=1){
                p = float2( p.x* p.x-p.y * p.y,
                           2.0f * p.x * p.y) + loc;
                depth = float(i);
                if((p.x*p.x+p.y*p.y) >= 4.0) break;
            }

}

Desired result (i wish to mix in many similar textures as highlights of background scenes)
(http://kepfeltoltes.hu/121015/11_burning_ship_0019_www.kepfeltoltes.hu_.png)
(http://kepfeltoltes.hu/121015/12_burning_ship_0001_www.kepfeltoltes.hu_.png)
(http://kepfeltoltes.hu/130225/Fractal-b004_www.kepfeltoltes.hu_.png)


Title: Re: Please suggest a Formula to texture 3D worlds?
Post by: tryptophan on October 27, 2013, 06:07:25 PM
Hi I have a patch that does exactly what you are asking for (I think) called FractGen in a programming environment called Touch Designer. It uses a bunch of formulas to draw 2d patterns using GLSL. It's super fast with high detail. You'll need to download the file at the link below and then you'll need to download and install Touch Designer (downloads link at the top of the page).

http://derivative.ca/Forum/viewtopic.php?f=22&t=4673&p=16840&hilit=fractgen#p16840

The formulas and shaders are within the network. If you need some help to find the formulas and shaders let me know.

cheers
Keith


Title: Re: Please suggest a Formula to texture 3D worlds?
Post by: Mrz00m on October 29, 2013, 09:40:45 PM
Hi, Thanks, that looks amazing! it is video feedback fractals? yes please could you tell me where the code is in the network?

the program is similar to Reaktor5 and the audio programs. :D


Title: Re: Please suggest a Formula to texture 3D worlds?
Post by: tryptophan on October 29, 2013, 10:03:26 PM
Hi thanks! It's actually not video feedback but it runs unbelievably fast. To find the GLSL shaders:

-open the patch
-press escape to exit out of perform mode
-press the "u" until your in the top level
-make sure the component "FractalGen" is selected and press i to enter it
-find the pink operator (DAT)  labeled "Fragment"
-the "+" symbol on the bottom right corner will toggle the viewer so you copy and past the text

if you look further back up the DAT chain you'll see how the different formulas are switched and then combined into one shader.

cheers
Keith


Title: Re: Please suggest a Formula to texture 3D worlds?
Post by: Mrz00m on November 03, 2013, 11:59:36 AM
Thanks! very interesting. i am learning from it.


Title: Re: Please suggest a Formula to texture 3D worlds?
Post by: SCORPION on November 06, 2013, 11:25:03 AM
I'm interested in and downloaded the program. The program requires a registration. I have registered, but neither the site nor the program does not accept my data. Letter to E-mail and did not come. What did I do wrong?


Title: Re: Please suggest a Formula to texture 3D worlds?
Post by: tryptophan on November 06, 2013, 05:54:44 PM
Hmm maybe they were having problems with there server or there is something up with your email address? Usually it's pretty straightforward, you just create an account at the site then use the user name you created to register and create a key when you start Touch.

I would try again today and if you still have problems maybe try a new email, especially if they didn't respond to a support email. Usually there support is unprecedented.

cheers
Keith


Title: Re: Please suggest a Formula to texture 3D worlds?
Post by: SCORPION on November 07, 2013, 02:49:51 AM
All turned to another post! I will learn! Thank you!


Title: Re: Please suggest a Formula to texture 3D worlds?
Post by: SCORPION on November 07, 2013, 04:03:32 AM
I am delighted with FractGen!!! But I can not find how to save the results as an image or animation.
Tabs "Fractal" and "Formula" is not active.
If the options are saved animation and graphics are not able to activate, it will be very sorry ....


Title: Re: Please suggest a Formula to texture 3D worlds?
Post by: tryptophan on November 07, 2013, 05:20:51 AM
You can export images or video from the non-commercial version but you are limited to a 1280 by 1024 resolution. There are a couple of ways to save a movie or image. You can use a movie out TOP if you would like to record realtime or you right click on any TOP (blue operator) and select export movie or export image. Oh yeah if you haven't been in network mode press the escape button. My earlier post has a couple of tips on how to navigate in the UI.

cheers
Keith


Title: Re: Please suggest a Formula to texture 3D worlds?
Post by: SCORPION on November 07, 2013, 02:55:12 PM
Thank you, something that turns out! For video resolution is right for me - I do not do more than 1280x720. For images not enough, but for the experiments is enough!


Title: Re: Please suggest a Formula to texture 3D worlds?
Post by: JohnVV on November 09, 2013, 09:30:54 AM
Quote
Anyways, I want to make a world texture generator for some games

I do a lot of work on textures for spherical meshes
they NEED to be in "SimpleCylindrical" planetcentric format
that way the poles ( north/south) will map correctly to a UVSphere

for example the output of "Torben Æ. Mogensen" program "planet "
(http://t.imgbox.com/ads49M1S.jpg) (http://imgbox.com/ads49M1S)
or "FractlPlanet"
(http://t.imgbox.com/admCz39P.jpg) (http://imgbox.com/admCz39P)

the mapping  in the above examples are
 90 north at top
-90 south at bottom
and left to right
-180 deg.W to 180 deg. E