Welcome to Fractal Forums

Fractal Software => Programming => Topic started by: tryptophan on April 15, 2013, 03:23:12 AM




Title: Mixing Fractal IFS types shader
Post by: tryptophan on April 15, 2013, 03:23:12 AM
I figured since people were so helpful in this forum with a bunch of the questions I've been having that I would share this new fragment shader I put together that mixes a few different IFS formulas together. I'm sure it could be better and there are few shortcomings but it does seem to produce some interesting shapes. It also has few unique aspects such as being able to choose which iterations both the pre and post rotations act on as well as it uses a cube shape for a trap so if you keep the iterations low the fractals appear to be made out of cubes.

If anyone would like to check it out I've attached the Fragmentarium version below. All the original fractal formulas came with Fragmentarium. Also I'm totally open to some suggestion on how to improve it.

cheers
Keith


Title: Re: Mixing Fractal IFS types shader
Post by: cKleinhuis on April 15, 2013, 08:49:04 AM
hmm, thank you for sharing, can you upload an example image of what might be produced with this ?
too bad, it seems to be off limit for my hardware:

Could not link shaders: Fragment shader(s) failed to link.
Fragment link error: HW_UNSUPPORTED.
Fragment Shader not supported by HW


Title: Re: Mixing Fractal IFS types shader
Post by: tryptophan on April 15, 2013, 09:38:49 AM
Hmm strange, all the other Fragmentarium frags work? I'm not sure why that would be happening.
Here's a few images.


Title: Re: Mixing Fractal IFS types shader
Post by: tryptophan on April 15, 2013, 09:39:35 AM
another


Title: Re: Mixing Fractal IFS types shader
Post by: tryptophan on April 15, 2013, 09:40:52 AM
and one more... There are still a lot more different styles and shapes that can be created.


Title: Re: Mixing Fractal IFS types shader
Post by: cKleinhuis on April 15, 2013, 10:37:19 AM
thank you, hybrids for the win ;)
it seems that the script produces a too long script for my gpu to run, i got a gts250 and i reach the maximum number of commands very soon :(


Title: Re: Mixing Fractal IFS types shader
Post by: Kali on April 15, 2013, 02:48:17 PM
Same error here... I have a Radeon 6870, but not sure if it's because too long script.


Title: Re: Mixing Fractal IFS types shader
Post by: Syntopia on April 15, 2013, 07:49:33 PM
Hi Tryptophan,

Your shader works fine on my Geforce 310M, but runs quite slow - probably because of the many registers. By locking some of the groups (using the padlock symbol), I was able to get a 500% speed increase.

Shader length cannot be the reason this code won't run on Kali's card. But I noticed there is an warning for the line 103:
Code:
vec3 tileSc =TileOffset/3;

It should be "3.0" instead of "3". ATI/AMD card are known to be picky about integer->float conversion. So that might be the reason.


Title: Re: Mixing Fractal IFS types shader
Post by: tryptophan on April 15, 2013, 09:38:50 PM
Ah thanks Syntopia I missed that. I didn't get a warning in TD and missed it when the compiled the shader in Fragmentarium. Usually I try to remember make sure all floats are set with .0 just for consistency but now I know why you actually have to for other types of video cards.

I also thought of possible speed increase by taking the if statements out of the iteration loop and out of the DE function so the mode is only set once per frame not once per iteration per pixel. I've just posted below the version with the fix and the new method for selecting hybrids. You might still want to lock parameters for speed increases. Also if your using the newest version of Fragmentarium all the presets were made using the old DE-Raytracer v0.9.1 which the script is now set to. You'll have to manually switch to the new DE-Raytracer if you want to use it.

cheers
Keith

Hopefully it will work fine on ATI cards