Texture mapping is killing me

Will Schroeder will.schroeder at kitware.com
Mon Jun 21 09:06:18 EDT 1999

Hi Jordi-

We don't want to see anyone die due to vtk use :-)

> 1) What are exactly the TCoords? For what I have understood every point 
> (of polygonal data) has 2 coords (if we want to map a 2D image) which
> correspond to the position of the image, so 0 0 is upper left, 1 1 is
> down right. Is this correct?

Think of a texture map as a piece of wallpaper that is glued on a surface mesh. The texture coordinates indicate where to glue the texture map. The lower-left point of the texture map corresponds to texture coordinate (0,0), the upper-right (1,1).

> 2) This means that all the points of the dataset must have TCoords?
>What if 
>I just want to color a region of my surface? If all the points of the
>mesh have
>TCoords associated, all of them must be mapped?

If you're going to use texture on an actor, all points require a texture coordinate. However, the points do not necessarily need to cover the entire range of texture coordinates - a common trick is to index into just a subregion of the texture. Sometimes this requires clever design of the texture map and texture coordinates.

> 3) Let's say that I have four points of the mesh which define kind of a
>frame and I want 
>limit the texture map to this frame? Is that possible? How can I do it?
>I guess that
>the 4 points are assigned TCoords 0,0 1,0 0,1 and 1,1. But the rest of
>the points(those outside the frame and those inside), what do I do with

Consider using a 1 or two component texture (Intensity or Intensity-Alpha). The intensity will modulate the underlying color - you could use this to create a black frame and everywhere else normal color. Look at graphics/examplesTcl/motor.tcl (and the texture map it refers to) for an example. This texture map uses transparancy to cut away geometry, as well as a section of zero intensity to highlight the cut edges with black.

If you set texture coordinates >1.0 or <0.0 and the Repeat ivar is on, modulo arithmetic will be used to cycle through the texture map.


This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.

More information about the vtkusers mailing list