[vtkusers] Bug + fix: vtkVolumeTextureMapper2D

Lisa Sobierajski Avila lisa.avila at kitware.com
Thu Jun 15 10:09:15 EDT 2000


Hello Jorrit,

Thanks for the bug fix. I actually have some changes to that class to check 
in (packing the textures into a larger texture for performance). I'll make 
the fix and check in the changes today.

As for the offset - that is due to problems with some PC OpenGL cards - 
they produce "unpleasant" results if you use the texture coordinate 0 or 1. 
So I bumped these coordinates in a bit to avoid this problem. At some point 
in the future we should re-visit this issue to see if this can be removed.

Lisa

At 06:11 AM 6/15/00, Jorrit Schaap wrote:
>Hi Lisa and vtkusers,
>
>I found a bug in the vtkVolumeTextureMapper2D. (I'm using nightly
>06/13/00)
>
>In the templated functions that calculate the rectangles and the
>textures, the size of the rectangles is to big. More specificaly: the
>array of floats, v, isn't set right. For example in the
>VolumeTextureMapper2D_XMajorDirection function it says:
>
>   v[1] = origin[1];
>   v[2] = origin[2];
>
>   v[4] = origin[1];
>   v[5] = spacing[2] * size[2] + origin[2];
>
>   v[7] = spacing[1] * size[1] + origin[1];
>   v[8] = spacing[2] * size[2] + origin[2];
>
>   v[10] = spacing[1] * size[1]  + origin[1];
>   v[11] = origin[2];
>
>I think this should be:
>
>   v[1] = origin[1];
>   v[2] = origin[2];
>
>   v[4] = origin[1];
>   v[5] = spacing[2] * (size[2] - 1) + origin[2];
>
>   v[7] = spacing[1] * (size[1] - 1) + origin[1];
>   v[8] = spacing[2] * (size[2] - 1) + origin[2];
>
>   v[10] = spacing[1] * (size[1] - 1) + origin[1];
>   v[11] = origin[2];
>
>the same goes for the functions VolumeTextureMapper2D_YMajorDirection
>and VolumeTextureMapper2D_ZMajorDirection: replace size[..] by (size[..]
>-1)
>
>This way the rendered volume is exactly the same size as its bounds are
>(for example shown by an outline).
>
>So far the bug and the fix. Furthermore I noticed something strange in
>the computation of the texturecoordinates t[..], but i'm not sure if its
>a bug.
>it says (just above the coputation of the v[..] values):
>
>   float offset[2];
>   offset[0] = 0.5 / (float)tsize[0];
>   offset[1] = 0.5 / (float)tsize[1];
>   t[0] = offset[0];
>   t[1] = offset[1];
>   t[2] = offset[0];
>   t[3] = ((float)size[2] / (float)tsize[1]) - offset[1];
>   t[4] = ((float)size[1] / (float)tsize[0]) - offset[0];
>   t[5] = ((float)size[2] / (float)tsize[1]) - offset[1];
>   t[6] = ((float)size[1] / (float)tsize[0]) - offset[0];
>   t[7] = offset[1];
>
>the offset values are 0.5 / 2^n with n >= 5  ( tsize[..] is always >=32
>)
>this means that offset[..] <= 0.015625
>then take a look at the computation of t[..], these values are always
>between offset and 1 - offset
>although offset is a very small value, t will never cover the entire
>interval between 0 and 1, which is the way to go if you want to see the
>entire texture on your rectangle.
>
>I'm puzzled by this, and maybe Lisa can explain why the offset is
>there...
>
>Kind regards,
>
>Jorrit
>
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: 
><http://public.kitware.com/cgi-bin/vtkfaq>
>vtkusers mailing list
>vtkusers at public.kitware.com
>http://public.kitware.com/mailman/listinfo/vtkusers






More information about the vtkusers mailing list