Welcome to Fractal Forums

Fractal Software => Other / General Discussion => Topic started by: cKleinhuis on January 22, 2012, 04:05:23 AM




Title: orbit trap rendering ?
Post by: cKleinhuis on January 22, 2012, 04:05:23 AM
have you ever thought about rendering an orbit trap of a triplex fractal as own object ???


Title: Re: orbit trap rendering ?
Post by: knighty on January 22, 2012, 12:17:43 PM
I did!  :D
The picture below from december 2009 is a rendering of orbit trap of low iteration mandelbulb power8 on 3 cylinders aligned to xyz axis (red for x, green for y and blue for z).

Iņigo Quilez already did it back in 2006 for quatrnion julia. (http://www.iquilezles.org/www/articles/orbittraps3d/orbittraps3d.htm)


Title: Re: orbit trap rendering ?
Post by: cKleinhuis on January 22, 2012, 02:10:49 PM
gotta try it in fragmentarium, i believe nice strutures can be found, especially when playing around with the trap mode ( min, max, avg, iter... )


Title: Re: orbit trap rendering ?
Post by: cKleinhuis on January 22, 2012, 02:12:12 PM
wow, the spirals on the Iņigo Quilez are intriguing, and low iteration orbit trap rendering should work very vell on gpu ....


Title: Re: orbit trap rendering ?
Post by: knighty on January 22, 2012, 07:15:16 PM
That's because the orbit trap IS a spiral ?

Xenodream is also (very) good for orbit traps rendering (http://www.fractalforums.com/index.php?action=gallery;sa=view;id=10039).  ;D


Title: Re: orbit trap rendering ?
Post by: knighty on January 22, 2012, 09:36:41 PM
Ok! here is my attempt with quaternion julia (fragmentarium script):
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.
//Knighty: modified the script to render orbit trap. The trap is just a cylinder

// 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)]

uniform float val; slider[-2,0,2]
uniform float cylRad; slider[0,0.1,1]
uniform float cylHeight; slider[0,2,5]

float cylinder(vec3 p){
p=p.yxz;
p.x-=val;
return max(abs(p.z)-cylHeight,length(p.xy)-cylRad);
}
// The inline expanded quaterion multiplications make this DE
// look much worse than it actually is.
float DE(vec3 pos) {
float d=10000.0;
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)));
float r = cylinder(p.xyz);
d=min(d,0.5 * r / length(dp));
if (p2 > Threshold) break;
}
// length(p);
return d;// 0.5 * r / length(dp);
}

#preset Default
FOV = 0.4
Eye = -3.92876,-4.64711,5.23499
Target = 1.01476,1.13689,-1.254
Up = -0.0539774,-0.724628,-0.687023
AntiAlias = 1
Detail = -3.01273
DetailAO = -0.5
FudgeFactor = 1
MaxRaySteps = 129
BoundingSphere = 3 Locked
Dither = 0.5 Locked
NormalBackStep = 1
AO = 0.529412,0.352941,0,0.7
Specular = 1.5
SpecularExp = 16
SpotLight = 1,1,1,0.38043
SpotLightDir = 0.1,0.1
CamLight = 1,1,1,1
CamLightMin = 0
Glow = 1,1,1,0.16667
GlowMax = 20
Fog = 0
HardShadow = 0
ShadowSoft = 12.9032
Reflection = 0
BaseColor = 1,1,1
OrbitStrength = 0.8
X = 0.5,0.6,0.6,0.7
Y = 1,0.6,0,0.4
Z = 0.8,0.78,1,0.5
R = 0.4,0.7,1,0.12
BackgroundColor = 1,0.666667,0
GradientBackground = 0.3
CycleColors = false
Cycles = 1.1
EnableFloor = false
FloorNormal = 0,0,0
FloorHeight = 0
FloorColor = 1,1,1
Iterations = 5
Threshold = 30
C = -0.68182,-0.63636,0,0
val = -0.144
cylRad = 0.31532
cylHeight = 5
#endpreset

#preset Round
FOV = 0.4
Eye = -1.49304,-1.07827,5.47996
Target = 0.940476,0.755427,-4.04451
Up = -0.118586,-0.968971,-0.21685
AntiAlias = 1
Detail = -3.01273
DetailAO = -0.5
FudgeFactor = 1
MaxRaySteps = 129
BoundingSphere = 3 Locked
Dither = 0.5 Locked
NormalBackStep = 1
AO = 0.529412,0.352941,0,0.7
Specular = 1.5
SpecularExp = 16
SpotLight = 1,1,1,0.38043
SpotLightDir = 0.1,0.1
CamLight = 1,1,1,1
CamLightMin = 0
Glow = 1,1,1,0.16667
GlowMax = 20
Fog = 0
HardShadow = 0
ShadowSoft = 12.9032
Reflection = 0
BaseColor = 1,1,1
OrbitStrength = 0.8
X = 0.5,0.6,0.6,0.7
Y = 1,0.6,0,0.4
Z = 0.8,0.78,1,0.5
R = 0.4,0.7,1,0.12
BackgroundColor = 1,0.666667,0
GradientBackground = 0.3
CycleColors = false
Cycles = 1.1
EnableFloor = false
FloorNormal = 0,0,0
FloorHeight = 0
FloorColor = 1,1,1
Iterations = 6
Threshold = 30
C = -0.68182,-0.63636,0,0
val = -1.84
cylRad = 0.69369
cylHeight = 0.0505
#endpreset


Title: Re: orbit trap rendering ?
Post by: cKleinhuis on January 22, 2012, 09:51:35 PM
i had to change the row:

float r = cylinder(p, 0.1);

to
float r = cylinder(p.xyz, 0.1);

because function signature demanded a 3 component vector, but p is 4 component ... it is working, and i am playing with it right now, thx


Title: Re: orbit trap rendering ?
Post by: knighty on January 23, 2012, 10:44:34 AM
Thanks. Nvidia glsl compiler is too "bad programmer" freindly. :fiery:


Title: Re: orbit trap rendering ?
Post by: cKleinhuis on January 23, 2012, 11:41:51 AM
Just tried out a simple sphere orbit length(p-center) i use ati card because the 6800 card has the best processing value compared to prize. . . Rendering of those sturctures is quite cool!