[vtk-developers] strange behaviour in vtkVolumeTextureMapper2D

Lisa Sobierajski Avila lisa.avila at kitware.com
Thu Jul 13 08:38:19 EDT 2000


Hello Sebastien,

We have seen some strange behavior here on a Sun which I suspect also 
originates from my recent changes. (The volume doesn't disappear - extra 
"garbage" is rendered all around the volume - what should be far outside 
the vertices of the quads). I'll look into it. What I don't understand is 
how altering the vertex coordinates just a bit can seriously affect the 
rendering. I made the change in response to another user who noticed that 
it should be size-1 instead of size (because 2 samples only cover a 
distance of 1 sample spacing between them). One other change I believe I 
made at the same time was to go from rendering polygons to rendering quads 
- maybe that has something to do with it.

Everything works find on Oxygen VX1, TNT2, and GeForce boards. My 
performance did slow down dramatically on my ATI Rage Pro at home, but I 
think this is just caused by the fact that I am downloading larger texture 
maps and that board cannot handle it.

Thanks for pointing out the problem.

Lisa




At 08:08 AM 7/13/00, Sebastien BARRE wrote:
>Hi
>
>I'm not a Volume Rendering specialist, but I guess there might be a bug in 
>the vtkVolumeTextureMapper2D. I'm sure about that, that's the reason why 
>I'm asking before fixing it :)
>
>I've been conducting some tests using my SGI 320 on both the VTK official 
>release 3.1.2, and the current CVS, and the CVS version has a buggy 
>behavior *on my computer* : the rendered model disappears from time to 
>time, then reappears, etc. It's quite disturbing because it prevents one 
>from viewing it correctly, and it also makes the interactions impossible : 
>if the model disappears during an interaction (rotation, zoom) the 
>interaction is not stopped but, as the model is rendered in 0 s., the 
>interaction is made at full speed and your object rotates thousands of 
>degrees in a second, or zoom 10000%, etc, and reappears wherever.
>
>I'm not able to understand 100% of the code, but I tried to step back the 
>history, and it seems to me that this behavior comes from :
>
>
>Revision : 1.19
>Date : 2000/6/15 16:10:8
>Author : 'avila'
>State : 'Exp'
>Lines : +357 -144
>Description :
>ENH: packed several textures into a bigger (user-controlled size)
>texture to improve performance. Also fixed a bug (reported on the
>users list) where size should have been size-1 for texture sizes.
>
>
>more specifically, to the change made "where size should have been size-1 
>for texture sizes".
>
>Here it is for example :
>
>cvs -z9 -q diff -r 1.18 -r 1.19 vtkVolumeTextureMapper2D.cxx (in directory 
>E:\src\vtk\vtk-cvs\graphics\)
>Index: vtkVolumeTextureMapper2D.cxx
>===================================================================
>RCS file: /vtk/cvsroot/vtk/graphics/vtkVolumeTextureMapper2D.cxx,v
>retrieving revision 1.18
>retrieving revision 1.19
>diff -r1.18 -r1.19
>111,133c165,194
><   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];
><
><   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];
><
>---
> >   offset[0] = 0.5 / (float)textureSize[0];
> >   offset[1] = 0.5 / (float)textureSize[1];
> >
> >   for ( i = 0; i < numTiles; i++ )
> >     {
> >     yTile = i / xTotal;
> >     xTile = i % xTotal;
> >
> >     t[i*8 + 0] = (float)((size[1]*(xTile  ))  )/(float)textureSize[0] + 
> offset[0];
> >     t[i*8 + 1] = (float)((size[2]*(yTile  ))  )/(float)textureSize[1] + 
> offset[1];
> >     t[i*8 + 2] = (float)((size[1]*(xTile  ))  )/(float)textureSize[0] + 
> offset[0];
> >     t[i*8 + 3] = (float)((size[2]*(yTile+1))-1)/(float)textureSize[1] - 
> offset[1];
> >     t[i*8 + 4] = (float)((size[1]*(xTile+1))-1)/(float)textureSize[0] - 
> offset[0];
> >     t[i*8 + 5] = (float)((size[2]*(yTile+1))-1)/(float)textureSize[1] - 
> offset[1];
> >     t[i*8 + 6] = (float)((size[1]*(xTile+1))-1)/(float)textureSize[0] - 
> offset[0];
> >     t[i*8 + 7] = (float)((size[2]*(yTile  ))  )/(float)textureSize[1] + 
> offset[1];
> >
> >     v[i*12 + 1] = origin[1];
> >     v[i*12 + 2] = origin[2];
> >
> >     v[i*12 + 4] = origin[1];
> >     v[i*12 + 5] = spacing[2] * (float)(size[2]-1) + origin[2];
> >
> >     v[i*12 + 7] = spacing[1] * (float)(size[1]-1) + origin[1];
> >     v[i*12 + 8] = spacing[2] * (float)(size[2]-1) + origin[2];
> >
> >     v[i*12 + 10] = spacing[1] * (float)(size[1]-1) + origin[1];
> >     v[i*12 + 11] = origin[2];
> >     }
> >
>
>If you remove the -1 for the (float)(size[x]-1), it works as expected. But 
>it might be a side-effect.
>
>Here are my changes (well, more a hack than a change, sorry) :
>
>cvs -z9 -q diff vtkVolumeTextureMapper2D.cxx (in directory 
>E:\src\vtk\vtk-cvs\graphics\)
>Index: vtkVolumeTextureMapper2D.cxx
>===================================================================
>RCS file: /vtk/cvsroot/vtk/graphics/vtkVolumeTextureMapper2D.cxx,v
>retrieving revision 1.21
>diff -r1.21 vtkVolumeTextureMapper2D.cxx
>186c186
><     v[i*12 + 5] = spacing[2] * (float)(size[2]-1) + origin[2];
>---
> >     v[i*12 + 5] = spacing[2] * (float)(size[2]) + origin[2];
>188,189c188,189
><     v[i*12 + 7] = spacing[1] * (float)(size[1]-1) + origin[1];
><     v[i*12 + 8] = spacing[2] * (float)(size[2]-1) + origin[2];
>---
> >     v[i*12 + 7] = spacing[1] * (float)(size[1]) + origin[1];
> >     v[i*12 + 8] = spacing[2] * (float)(size[2]) + origin[2];
>191c191
><     v[i*12 + 10] = spacing[1] * (float)(size[1]-1) + origin[1];
>---
> >     v[i*12 + 10] = spacing[1] * (float)(size[1]) + origin[1];
>536c536
><     v[i*12 + 5] = spacing[2] * (float)(size[2]-1) + origin[2];
>---
> >     v[i*12 + 5] = spacing[2] * (float)(size[2]) + origin[2];
>538,539c538,539
><     v[i*12 + 6] = spacing[0] * (float)(size[0]-1) + origin[0];
><     v[i*12 + 8] = spacing[2] * (float)(size[2]-1) + origin[2];
>---
> >     v[i*12 + 6] = spacing[0] * (float)(size[0]) + origin[0];
> >     v[i*12 + 8] = spacing[2] * (float)(size[2]) + origin[2];
>541c541
><     v[i*12 +  9] = spacing[0] * (float)(size[0]-1) + origin[0];
>---
> >     v[i*12 +  9] = spacing[0] * (float)(size[0]) + origin[0];
>885c885
><     v[i*12 + 4] = spacing[1] * (float)(size[1]-1) + origin[1];
>---
> >     v[i*12 + 4] = spacing[1] * (float)(size[1]) + origin[1];
>887,888c887,888
><     v[i*12 + 6] = spacing[0] * (float)(size[0]-1) + origin[0];
><     v[i*12 + 7] = spacing[1] * (float)(size[1]-1) + origin[1];
>---
> >     v[i*12 + 6] = spacing[0] * (float)(size[0]) + origin[0];
> >     v[i*12 + 7] = spacing[1] * (float)(size[1]) + origin[1];
>890c890
><     v[i*12 +  9] = spacing[0] * (float)(size[0]-1) + origin[0];
>---
> >     v[i*12 +  9] = spacing[0] * (float)(size[0]) + origin[0];
>
>*****CVS exited normally with code 1*****
>
>
>As you understand, I'm not quite sure about what I'm doing, hence I'm 
>asking (Lisa ?), what was this -1 for, are you sure about that ?
>
>Thanks
>--
>Sebastien BARRE
>IRCOM-SIC, UMR-CNRS 6615 - Université de Poitiers
>Bât. SP2MI, Bvd 3 - Téléport 2, BP 179 F-86960 Futuroscope Cedex
>Tel. : +33 (0)5 49 49 65 92, Fax : +33 (0)5 49 49 65 70
>http://www-sic.univ-poitiers.fr/barre/ ou  http://www.hds.utc.fr/~barre/

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


More information about the vtk-developers mailing list