Logo by reallybigname - 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: Visit us on facebook
 
*
Welcome, Guest. Please login or register. April 16, 2024, 04:16:28 PM


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: Quantized Space for DE and easier (mathematical) object manipulation  (Read 388 times)
0 Members and 1 Guest are viewing this topic.
M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« on: January 09, 2016, 07:41:24 AM »

  I'm thinking about setting up a multidimensional array to hold orbitTrap information and distance estimates.  Rough idea follows.

Code:
vec4   is a 4 dimensional vector

pixel_resolution_3d =  pixel resolution of 3d array;
   //if pixel_resolution_3d=.05      (-.71,.18,.23) =  (-.70,.20,.25)

arrayElements = elements of x,y, and z in the array;  //set odd because of origin

arrayBoundingCubeEdgeLength =  pixel_resolution_3d * (arrayElements-1);

// outside of the array bounding cube, distance is calculated the old way

x_int, y_int, z_int = integer value of pixels with range of  [1 to arrayElements]

  if  (arrayElements==513)  
     x_int, y_int, and z_int    range from 1 to 513  

     (0.,0.,0.) = (x_int=257, y_int=257, z_int=257)

  halfBCEL= arrayBoundingCubeEdgeLength/2;   //half the bounding cube edge length

     (-halfBCEL, -halfBCEL, -halfBCEL) = (x_int=1, y_int=1, z_int=1)    =  (1,1,1)  
     ( halfBCEL,  halfBCEL,  halfBCEL) = (x_int=513, y_int=513, z_int=513)   =  (513,513,513)


  At every (x_int, y_int, z_int)  store orbitTrap and DE information for each iteration
(or application) of formulas so that we can use the data if we want to start recalculating
 from a slightly earlier iteration:

vec4   pointData [x_int][y_int][z_int][iteration] =  
    vec4 (x_orbit [iteration], y_orbit [iteration], z_orbit[iteration], DE [iteration])

   //note we can recover our running derivative, dr (or whatever you call it), from our DE using
the x,y,and z orbit values for the last iteration, so we have ALL of the information available to
us to us in the above 4-dimensional array of a 4 dimensional vector

pointData [1][1][1][8]  would be the point data for the 8th iteration of formulas
applied at the point (-halfBCEL, -halfBCEL, -halfBCEL)


  Why do this?

Code:
 1)  Streamline (reduce compute cost of) fractal calculation (ray paths cross the same areas over and over, although not one of them follows the EXACT same path).  

    condition a:  we take our initial DE, DEi, of point (x,y,z) and the fractal is much greater distance away than pixel_resolution_3d, so we assign DE to many points in the area:

         -assign DE (DEi) or an average DE to all points within  (x +/- [DEi * sqrt (3/8)] , y +/- [DEi * sqrt(3/8)] , z +/- [DEi *sqrt(3/8)])

                  - average DE, ADEi, of point DEi, using the center of 6 faces of a cube, and its center:  

                 ADEi=  [DE  (x+DEi*sqrt(3/8), y, z)  +  DE  (x - DEi *sqrt(3/8), y, z) + DE (x, y+ DEi *sqrt(3/8) +... DE (x, y, z - DEi * sqrt(3/8) +  DEi] / 7;
        
  We don't have to recalculate DE for every point in every ray- we check to see what point we are closest to and see if it has DE assigned or not- if not, we calculate DE for it, and assign DE to points in the vicinity that do not already have DE assigned.  Because our space is quantized, more than one ray will go through the same point too:

  At resolution_3d= .05, a ray going through  (-.71,.18,.23) will use the DE for (-.70,.20,.25), as will a ray going through (-.69,.21,.26)


  2)  If we apply additional transforms or skews to the fractal, we don't have to recalculate everything, we just apply the transforms to the existing data.  

  The main reason is to increase our ability to manipulate mathematical objects.  Currently, the fractal spray gun implementation requires a complete recalculation for every single thing we do.  This adds up- we have an interior loop in the frag, which we have to check through for each DE calculation. 
« Last Edit: January 10, 2016, 02:40:42 AM by M Benesi » Logged

M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« Reply #1 on: January 12, 2016, 03:14:50 AM »

   Working on it.. 




  First step, setup quantization code in raytracer (haha.. looked up Aexion's code because I thought someone had done something similar... and I was right!). 

Code:
// Outside of trace(...) function:

#group Quantization
uniform float CubeCircumsphereRadius;slider[0.01,2.,4.]
uniform int CubePixelsPerRadiusPower2;slider[5,6,10]
float CubePixelsPerRadius=pow(2.,float(CubePixelsPerRadiusPower2));
float resolution3d=CubeCircumsphereRadius/(CubePixelsPerRadius);
float inverseResolution3d=1./resolution3d;

vec3 quantize (vec3 point) {
point*=inverseResolution3d;
 //round is not in version 120!!! is version 130!!!!
         //floor is good enough, although round would be better...  
point = vec3 (floor(point.x),floor(point.y),floor(point.z));
point *= resolution3d;

return point;
}

//Inside of trace(..) function's DE check loop:

vec3 p = from + totalDist * direction;
p=quantize(p);
dist = DE(p);


  DE could be quantized (in the array) as multiples of 2^n * sqrt(3)- although I'm not sure that it's necessary.
  We'll check points at our minimum resolution first (probably around 1/4 so):

  an array at resolution 1/4 will have points at:

  (1.75,0,0) =(7,0,0)    (2,.25,.5)= (8,1,2)   etc.            it's quantized DE could be sqrt(3)/4, or something along those lines         


   If its DE is much greater than resolution_3d, then we'll copy the DE into adjacent points at its resolution (after testing a bit- might want some average distance or something).  So maybe point (2,.25,.25) will have the same DE as (2,0,0) or (1.75,.25,0).  We'll check lower resolution points first, maybe set a minimum resolution that we first check. to grab our initial DE from (instead of recalculating a bunch of times). 


  anyway.. 
« Last Edit: January 12, 2016, 09:00:25 AM by M Benesi » Logged

Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Mathematical Art Museum Introduction to Fractals and Related Links titia 2 2690 Last post July 03, 2007, 02:52:27 AM
by Nahee_Enterprises
Manipulation Mandelbulb3D Gallery mandelfrau 0 468 Last post August 10, 2011, 06:11:52 PM
by mandelfrau
Mandelbulb on my new laptop...creation much easier but rendering still slow! Help & Support chaos_crystal 0 321 Last post April 01, 2013, 07:00:09 PM
by chaos_crystal
Nature manipulation Mandelbulb3D Gallery Payam 0 605 Last post January 11, 2015, 07:12:13 AM
by Payam
Easier to convert to .obj feature request cyseal 11 3208 Last post December 10, 2015, 12:06:16 AM
by thargor6

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.136 seconds with 24 queries. (Pretty URLs adds 0.005s, 2q)