[vtkusers] Problem Interpreting z-buffer data. -- how to convert z-buffer values to quantitative measurements !!!!!!

Deepak Roy cdeepakroy at yahoo.com
Thu Dec 8 11:55:41 EST 2005


hello,
   
  I am trying to compute the volume enclosed between two surface by subtracting the z-buffers of the two surfaces. I am using parallel projection for the computation.
   
  I computed the z-buffer difference, This difference is relative to the viewport size set up. I have no idea how to convert this difference to a quantitative estimate of the voume. I have problems interpreting the z-buffer data.
   
  Firslty, how to set the orthographic projection in VTK ? i call vtkRenderer::ParallelProjectionOn and then invoke vtkRenderer::ResetCamera. Is this enough ? or is anything wrong.  Because when i looked through the VTK code, i found glOrtho in vtkCamera::ComputePerspectiveTransform.
   
  How can i transform the z-buffer values to quantitative z-values of the geometry renderer ?
   
  I tried multiplying it with the inverse of the vrkCamera::GetViewTransformation matrix but it doesnt work.
   
  I also tried doing vtkCamera::ViewToWorld on the final difference but this still does not work.
   
  Can anyone tell me, how to transform the z-buffer difference to a quantitative estimate of the volume. 
   
  Please Help !!!!!!!!
   
  Thanks in advance.
   
  Regards,
   
  Deepak
   
   
   
  **************************************************************************************************
   
  Here is the loop that computes the z-difference:
   
    double dblSphereVolume = 0.0;
   
  for( int i = 0 ; i < wx ; i++ )
  {
    for( int j = 0 ; j < wy ; j++ )
  {
    long index = i * j;
  float coons_depth, sphere_depth;
   
  
  // get hemi-sphere z
  sphere_depth = pSphereZBuffer[index];
   
  
  // get z of the base plane of the hemisphere
   
  coons_depth = pCoonsZBuffer[index];
  
   
  double diff = ( coons_depth - sphere_depth );
  dblSphereVolume += diff;
  }
  }
   
  printf( "\ncomputed Sphere volume = %f\n" , dblSphereVolume );


			
---------------------------------
Yahoo! Shopping
 Find Great Deals on Holiday Gifts at Yahoo! Shopping 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20051208/27f62133/attachment.htm>


More information about the vtkusers mailing list