[vtk-developers] Artifacts in vtkFixedPointVolumeRayCastMapper

Tiago Etiene Queiroz tiago.etiene at gmail.com
Tue Nov 15 18:43:59 EST 2011


Hi,

I've run into the same problem as described in http://vtk.org/Bug/view.php?id=5519 and http://public.kitware.com/pipermail/vtk-developers/2007-August/004678.html while testing convergence properties of the VTK fixed point volume rendering. Essentially, the images generated should converge to a pre-defined ground-truth (under some conditions) at the right speed. However, it did not converged. Below I describe the problem and also a possible solution for this problem. i've compiled Paraview 3.12.0 on Linux.

I tried to apply the patch suggested in  http://vtk.org/Bug/view.php?id=5519 but it  segfaulted my code (I need to check why). However, I do not think that the problem is the computation of numSteps or that the values of dir[i] are too close to zero. I think the problem is the rounding during conversion from float to fixed-point precision. When dir[i] approaches to zero (for i = {0, 1, 2}), the conversion from float to fixed-point precision may double the value of dir[i]. This is because the conversion is done as:

new_dir[i] = dir[i] * VTKKW_FP_SCALE + 0.5

The '+ 0.5', used for rounding, will make values of new_dir[0] to be 1 when it should have been 0. Suppose that dir[i] == 1.5E-5. Then, new_dir[i] == 1, because 0.5 is added. As a result, if one recovers dir[i] one gets 3.0E-5, which doubles the size on the i-direction. Hence the number of steps required to traverse the volume diminishes in 1/2 (in this example). See http://dl.dropbox.com/u/4483810/before.png for an example of the problem.
By simply removing the '+ 0.5' part, the image is fixed and the black lines no longer appears. Also, in my tests I observed the rendered image converged to the right image, at the right speed. See http://dl.dropbox.com/u/4483810/after.png for an example obtained after the fixing it.

In my tests, I have only changed the method:

inline unsigned int vtkFixedPointVolumeRayCastMapper::ToFixedPointDirection( float dir ).

I did not change the overloaded version (because it is not used):

inline void vtkFixedPointVolumeRayCastMapper::ToFixedPointDirection( float in[3], unsigned int out[3] ) 


Best,
-- tiago


 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20111115/db4e7b24/attachment.html>


More information about the vtk-developers mailing list