Logo by Mahmut - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Check out the originating "3d Mandelbulb" thread here
 
*
Welcome, Guest. Please login or register. April 19, 2024, 10:33:53 AM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: 3D Julia Set Cross Section Distance Estimated Algorithm  (Read 2358 times)
0 Members and 1 Guest are viewing this topic.
Geometrian
Forums Freshman
**
Posts: 19


« on: May 01, 2013, 11:16:39 PM »

Hi,

I have been trying to get a distance estimated render working for rendering a 3D slice through the Julia Set. My approach is based off of some example code and some theory. It is:
Code:
#define COMPLEX_MUL(V1,V2, RESULT) { vec2 _temp=V1*V2; RESULT=vec2(_temp.x-_temp.y,V1.x*V2.y+V1.y*V2.x); } /*  RESULT = V1 * V2  */
#define COMPLEX_SQADD(V1,V2, RESULT) { vec2 _temp1=V1*V1; float _temp2=V1.x*V1.y; RESULT=vec2(_temp1.x-_temp1.y,_temp2+_temp2)+V2; } /*  RESULT = V1*V1 + V2  */

float julia3D_de(int n, vec3 pos) { //returns distance
//Complex numbers are stored as a two element vector (vec2) as <real,imag>.

vec2 z=pos.xy; //z
vec2 c=vec2(pos.z,0.5); //c; I have tried many other values than 0.5
vec2 zp = vec2(1.0,0.0); //z', the running derivative, initially 1.0+0.0i

for (int j=0;j<n;++j) {
vec2 temp = z;
COMPLEX_MUL(z,zp, temp) //temp = z*zp, complex multiplication
zp = 2.0 * temp;

COMPLEX_SQADD(z,c, z) //z = z*z + c

if (dot(z,z) > 16.0) { //Have tried 2.0, 4.0, and several other values here
break;
}
}

float normZ = length(z);
return 0.5 * normZ * log(normZ) / length(zp);
};
This code doesn't produce anything that looks right; it produces a blob with filaments--and no internal structure.  The boundary for stepping is -5.0 to 5.0 on all axes, and is iterated to distance tolerance 0.0001.

Does this look like the right approach?  Am I missing anything obvious?

Thanks,
Ian
Logged
Pages: [1]   Go Down
  Print  
 
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.157 seconds with 24 queries. (Pretty URLs adds 0.008s, 2q)