Welcome to Fractal Forums

Fractal Math, Chaos Theory & Research => Fractal Flames => Topic started by: cyseal on September 24, 2015, 03:41:31 PM




Title: Quaternion Julia to flames
Post by: cyseal on September 24, 2015, 03:41:31 PM
How to translate Quaternition julia from Fragmentarium to flames in Apophysis as some slice or 2D projection ?

(https://dl.dropboxusercontent.com/u/13451287/Capture1.PNG)
Code:
#info 4D Quaternion Julia Distance Estimator
#include "DE-Raytracer.frag"
#group 4D Quaternion Julia

// The DE implementation here is based on the implementation by Subblue:
//  http://www.subblue.com/blog/2009/9/20/quaternion_julia
// which in turn is based on a CG shader by Keenan Crane.
// My implementation here is very compressed, so take a look at Subblue's above for a much clearer implementation.

// Number of fractal iterations.
uniform int Iterations;  slider[0,16,100]
// Breakout distance
uniform float Threshold; slider[0,10,100]
// Quaterion Constant
uniform vec4 C; slider[(-1,-1,-1,-1),(0.18,0.88,0.24,0.16),(1,1,1,1)]


// The inline expanded quaterion multiplications make this DE
// look much worse than it actually is.
float DE(vec3 pos) {
vec4 p = vec4(pos, 0.0);
vec4 dp = vec4(1.0, 0.0,0.0,0.0);
for (int i = 0; i < Iterations; i++) {
dp = 2.0* vec4(p.x*dp.x-dot(p.yzw, dp.yzw), p.x*dp.yzw+dp.x*p.yzw+cross(p.yzw, dp.yzw));
p = vec4(p.x*p.x-dot(p.yzw, p.yzw), vec3(2.0*p.x*p.yzw)) + C;
float p2 = dot(p,p);
orbitTrap = min(orbitTrap, abs(vec4(p.xyz,p2)));
if (p2 > Threshold) break;
}
float r = length(p);
return  0.5 * r * log(r) / length(dp);
}



Title: Re: Quaternion Julia to flames
Post by: DarkBeam on September 24, 2015, 06:00:26 PM
There is no easy way to do so.
In fact flames need a function inversion to work like their escapetime counterpart. See juliaN plugin in the Apo source code to have an idea.

http://sourceforge.net/projects/apophysis/files/

This is way more complicated in 4D though and I really think it wouldn't give a so great result at all? ;)


Title: Re: Quaternion Julia to flames
Post by: cKleinhuis on September 24, 2015, 06:13:35 PM
check this thread, at least a mandelbulb can be done relatively easily ;)
http://www.fractalforums.com/images-showcase-(rate-my-fractal)/yes!-a-mandelbulb-in-apophysis!!!/


Title: Re: Quaternion Julia to flames
Post by: cyseal on September 24, 2015, 08:01:15 PM
Thx
1) Is it possible to make Apo 7x 3d renderer as M3D or Fragmentaruim?

2) When you write C++ formula, how to integrate it as  Apo 7x plugin ?
I'm using Codelite.


Title: Re: Quaternion Julia to flames
Post by: DarkBeam on September 25, 2015, 11:48:33 AM
1) no!  :) :dink:
But you ofc can render 3d flames that will look always different from any escapetime solid render as normally flames tend to fade away somewhere. You can get solid colors in some cases btw but it is a complicated task...
Flames work with successive color pixels and colors blend each other normally.
2) see this repository by Xyrus:
http://code.xyrus-worx.org/listing.php?repname=Apophysis+Plugins&

I strongly reccommend you to get JWILDFIRE much more simple for plugin design and more powerful. ;)