next up prev
Next: Assigning color Up: Ray Casting algorithm Previous: Ray Casting algorithm

Filling the depth buffer

Each point on the image plane defines a ray through that point starting at the camera. The ray caster then samples the frustum along this ray starting from the image plane. Before iterating the map the points are transformed as outlined in section [*]. The transformed point is then iterated with the map q2+c. If the point is within distance 2 of the origin after reaching the maximum number of iterations it is considered to be bounded and therefore inside the fractal. Points are sampled until either the far plane is hit or two points bounding the surface are found. In that case a binary search is done to locate the surface more precisely.


  foreach pixel

    point = pixel;

    while(point < far_plane)





        point += step;

     depth[pixel] = point - pixel; 


  for i=0 to num_adaptave_iterations

    step_size /= 2;


      point += step_size;


      point -= step_size; 

This step of the algorithm is parallelized by scanline, with an arbitrary number of threads computing scanlines in parallel.

brian martin