<html>
Hi<br>
<br>
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 :)<br>
<br>
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.<br>
<br>
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 :<br>
<br>
<br>
<font face="Lucida Console" size=2>Revision :
</font><font face="Lucida Console" size=2 color="#FF0000"><b>1.19<br>
</font></b><font face="Lucida Console" size=2>Date : <b>2000/6/15
16:10:8<br>
</b>Author : '<b>avila</b>'<br>
State : '<b>Exp</b>'<br>
Lines : +<b>357 -144<br>
</b>Description :<br>
</font><font face="Lucida Console" size=2 color="#808000">ENH: packed
several textures into a bigger (user-controlled size)<br>
texture to improve performance. Also fixed a bug (reported on the<br>
users list) where size should have been size-1 for texture sizes.<br>
<br>
<br>
</font>more specifically, to the change made "where size should have
been size-1 for texture sizes".<br>
<br>
Here it is for example :<br>
<br>
<font face="Lucida Console" size=2>cvs -z9 -q diff -r 1.18 -r 1.19
vtkVolumeTextureMapper2D.cxx (in directory
E:\src\vtk\vtk-cvs\graphics\)<br>
Index: vtkVolumeTextureMapper2D.cxx<br>
===================================================================<br>
RCS file: /vtk/cvsroot/vtk/graphics/vtkVolumeTextureMapper2D.cxx,v<br>
retrieving revision 1.18<br>
retrieving revision 1.19<br>
diff -r1.18 -r1.19<br>
111,133c165,194<br>
</font><font face="Lucida Console" size=2 color="#FF0000"><  
offset[0] = 0.5 / (float)tsize[0];<br>
<   offset[1] = 0.5 / (float)tsize[1];<br>
<   t[0] = offset[0];<br>
<   t[1] = offset[1];<br>
<   t[2] = offset[0];<br>
<   t[3] = ((float)size[2] / (float)tsize[1]) -
offset[1];<br>
<   t[4] = ((float)size[1] / (float)tsize[0]) -
offset[0];<br>
<   t[5] = ((float)size[2] / (float)tsize[1]) -
offset[1];<br>
<   t[6] = ((float)size[1] / (float)tsize[0]) -
offset[0];<br>
<   t[7] = offset[1];<br>
< <br>
<   v[1] = origin[1];<br>
<   v[2] = origin[2];<br>
< <br>
<   v[4] = origin[1];<br>
<   v[5] = spacing[2] * size[2] + origin[2];<br>
< <br>
<   v[7] = spacing[1] * size[1] + origin[1];<br>
<   v[8] = spacing[2] * size[2] + origin[2];<br>
< <br>
<   v[10] = spacing[1] * size[1] + origin[1];<br>
<   v[11] = origin[2];<br>
< <br>
</font><font face="Lucida Console" size=2>---<br>
</font><font face="Lucida Console" size=2 color="#0000FF">>  
offset[0] = 0.5 / (float)textureSize[0];<br>
>   offset[1] = 0.5 / (float)textureSize[1];<br>
>   <br>
>   for ( i = 0; i < numTiles; i++ )<br>
>     {<br>
>     yTile = i / xTotal;<br>
>     xTile = i % xTotal;<br>
>     <br>
>     t[i*8 + 0] = (float)((size[1]*(xTile 
))  )/(float)textureSize[0] + offset[0];<br>
>     t[i*8 + 1] = (float)((size[2]*(yTile 
))  )/(float)textureSize[1] + offset[1];<br>
>     t[i*8 + 2] = (float)((size[1]*(xTile 
))  )/(float)textureSize[0] + offset[0];<br>
>     t[i*8 + 3] =
(float)((size[2]*(yTile+1))-1)/(float)textureSize[1] - offset[1];<br>
>     t[i*8 + 4] =
(float)((size[1]*(xTile+1))-1)/(float)textureSize[0] - offset[0];<br>
>     t[i*8 + 5] =
(float)((size[2]*(yTile+1))-1)/(float)textureSize[1] - offset[1];<br>
>     t[i*8 + 6] =
(float)((size[1]*(xTile+1))-1)/(float)textureSize[0] - offset[0];<br>
>     t[i*8 + 7] = (float)((size[2]*(yTile 
))  )/(float)textureSize[1] + offset[1];<br>
>     <br>
>     v[i*12 + 1] = origin[1];<br>
>     v[i*12 + 2] = origin[2];<br>
>     <br>
>     v[i*12 + 4] = origin[1];<br>
>     v[i*12 + 5] = spacing[2] *
(float)(size[2]-1) + origin[2];<br>
>     <br>
>     v[i*12 + 7] = spacing[1] *
(float)(size[1]-1) + origin[1];<br>
>     v[i*12 + 8] = spacing[2] *
(float)(size[2]-1) + origin[2];<br>
>     <br>
>     v[i*12 + 10] = spacing[1] *
(float)(size[1]-1) + origin[1];<br>
>     v[i*12 + 11] = origin[2];<br>
>     }<br>
>   <br>
<br>
</font>If you remove the -1 for the (float)(size[x]-1), it works as
expected. But it might be a side-effect.<br>
<br>
Here are my changes (well, more a hack than a change, sorry) :<br>
<br>
<font face="Lucida Console" size=2>cvs -z9 -q diff
vtkVolumeTextureMapper2D.cxx (in directory
E:\src\vtk\vtk-cvs\graphics\)<br>
Index: vtkVolumeTextureMapper2D.cxx<br>
===================================================================<br>
RCS file: /vtk/cvsroot/vtk/graphics/vtkVolumeTextureMapper2D.cxx,v<br>
retrieving revision 1.21<br>
diff -r1.21 vtkVolumeTextureMapper2D.cxx<br>
186c186<br>
</font><font face="Lucida Console" size=2 color="#FF0000"><    
v[i*12 + 5] = spacing[2] * (float)(size[2]-1) + origin[2];<br>
</font><font face="Lucida Console" size=2>---<br>
</font><font face="Lucida Console" size=2 color="#0000FF">>    
v[i*12 + 5] = spacing[2] * (float)(size[2]) + origin[2];<br>
</font><font face="Lucida Console" size=2>188,189c188,189<br>
</font><font face="Lucida Console" size=2 color="#FF0000"><    
v[i*12 + 7] = spacing[1] * (float)(size[1]-1) + origin[1];<br>
<     v[i*12 + 8] = spacing[2] *
(float)(size[2]-1) + origin[2];<br>
</font><font face="Lucida Console" size=2>---<br>
</font><font face="Lucida Console" size=2 color="#0000FF">>    
v[i*12 + 7] = spacing[1] * (float)(size[1]) + origin[1];<br>
>     v[i*12 + 8] = spacing[2] * (float)(size[2])
+ origin[2];<br>
</font><font face="Lucida Console" size=2>191c191<br>
</font><font face="Lucida Console" size=2 color="#FF0000"><    
v[i*12 + 10] = spacing[1] * (float)(size[1]-1) + origin[1];<br>
</font><font face="Lucida Console" size=2>---<br>
</font><font face="Lucida Console" size=2 color="#0000FF">>    
v[i*12 + 10] = spacing[1] * (float)(size[1]) + origin[1];<br>
</font><font face="Lucida Console" size=2>536c536<br>
</font><font face="Lucida Console" size=2 color="#FF0000"><    
v[i*12 + 5] = spacing[2] * (float)(size[2]-1) + origin[2];<br>
</font><font face="Lucida Console" size=2>---<br>
</font><font face="Lucida Console" size=2 color="#0000FF">>    
v[i*12 + 5] = spacing[2] * (float)(size[2]) + origin[2];<br>
</font><font face="Lucida Console" size=2>538,539c538,539<br>
</font><font face="Lucida Console" size=2 color="#FF0000"><    
v[i*12 + 6] = spacing[0] * (float)(size[0]-1) + origin[0];<br>
<     v[i*12 + 8] = spacing[2] *
(float)(size[2]-1) + origin[2];<br>
</font><font face="Lucida Console" size=2>---<br>
</font><font face="Lucida Console" size=2 color="#0000FF">>    
v[i*12 + 6] = spacing[0] * (float)(size[0]) + origin[0];<br>
>     v[i*12 + 8] = spacing[2] * (float)(size[2])
+ origin[2];<br>
</font><font face="Lucida Console" size=2>541c541<br>
</font><font face="Lucida Console" size=2 color="#FF0000"><    
v[i*12 +  9] = spacing[0] * (float)(size[0]-1) + origin[0];<br>
</font><font face="Lucida Console" size=2>---<br>
</font><font face="Lucida Console" size=2 color="#0000FF">>    
v[i*12 +  9] = spacing[0] * (float)(size[0]) + origin[0];<br>
</font><font face="Lucida Console" size=2>885c885<br>
</font><font face="Lucida Console" size=2 color="#FF0000"><    
v[i*12 + 4] = spacing[1] * (float)(size[1]-1) + origin[1];<br>
</font><font face="Lucida Console" size=2>---<br>
</font><font face="Lucida Console" size=2 color="#0000FF">>    
v[i*12 + 4] = spacing[1] * (float)(size[1]) + origin[1];<br>
</font><font face="Lucida Console" size=2>887,888c887,888<br>
</font><font face="Lucida Console" size=2 color="#FF0000"><    
v[i*12 + 6] = spacing[0] * (float)(size[0]-1) + origin[0];<br>
<     v[i*12 + 7] = spacing[1] *
(float)(size[1]-1) + origin[1];<br>
</font><font face="Lucida Console" size=2>---<br>
</font><font face="Lucida Console" size=2 color="#0000FF">>    
v[i*12 + 6] = spacing[0] * (float)(size[0]) + origin[0];<br>
>     v[i*12 + 7] = spacing[1] * (float)(size[1])
+ origin[1];<br>
</font><font face="Lucida Console" size=2>890c890<br>
</font><font face="Lucida Console" size=2 color="#FF0000"><    
v[i*12 +  9] = spacing[0] * (float)(size[0]-1) + origin[0];<br>
</font><font face="Lucida Console" size=2>---<br>
</font><font face="Lucida Console" size=2 color="#0000FF">>    
v[i*12 +  9] = spacing[0] * (float)(size[0]) + origin[0];<br>
<br>
</font><font face="Lucida Console" size=2>*****CVS exited normally with
code 1*****<br>
<br>
<br>
</font>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 
?<br>
<br>
Thanks<br>
<div>-- </div>
<div>Sebastien BARRE</div>
<div>IRCOM-SIC, UMR-CNRS 6615 - Université de Poitiers </div>
<div>Bât. SP2MI, Bvd 3 - Téléport 2, BP 179 F-86960 Futuroscope Cedex
</div>
<div>Tel. : +33 (0)5 49 49 65 92, Fax : +33 (0)5 49 49 65 70 </div>
<a href="http://www-sic.univ-poitiers.fr/barre/" EUDORA=AUTOURL>http://www-sic.univ-poitiers.fr/barre/</a>
ou  <a href="http://www.hds.utc.fr/~barre/" EUDORA=AUTOURL>http://www.hds.utc.fr/~barre/</a>
</html>