[vtkusers] Re: Scalar color / LookupTable / Interpolation problem...

David.Pont at ForestResearch.co.nz David.Pont at ForestResearch.co.nz
Mon May 3 19:48:44 EDT 2004


Rainer,
   thanks for the tip re glColorTable. I am getting out of my depth in
OpenGL here, but a quick search around indicates this is an OpenGL issue.
Given glShadeModel: GL_SMOOTH (colour varies across polygon face) rather
than GL_FLAT (polygon has one colour), OpenGL performs separate linear
interpolation of R, G and B across a polygon face. This is done with no
knowledge of the vtk lookup table, so it can produce colours outside the
lookup table. This problem has been observed in applications other than
vtk.
There are two basic display modes, (selected in a hardware dependant way)?,
for example in glut:
      glutInitDisplayMode: GLUT_RGB (the default) or GLUT_INDEX
RGB mode allows per vertex colours (with GL_SMOOTH) to be specified and
colours will be interpolated across the polygon. INDEX mode is an
alternative where a colour table is pre-specified to OpenGL (in a hardware
dependant way) and per vertex indices to the table are given. I have not
found a clear statement on this but I guess the table indices would be
interpolated across the polygon. Notably this should not produce a colour
outside the colour table.

Ingo, can you search your OpenGL application for "INDEX", perhaps this is
how it was done?

So vtk can probably be extended to support this with OpenGL by making
significant (and  hardware dependant!) extensions to vtk*Mapper and
vtk*RenderWindow and others?. There may be problems converting a
vtkLookupTable to an OpenGL 'color' table in a general way.

My quick search also turned up the following:
"For most systems, more colors can be simultaneously represented with RGBA
mode than with color-index mode. Also, for several effects, such as
shading, lighting, texture mapping, and fog, RGBA provides more flexibility
than color-index mode. ... In general, use RGBA mode wherever possible. It
works with texture mapping and works better with lighting, shading, fog,
antialiasing, and blending."

So besides requiring 'major surgery' in the vtk rendering code, use of
INDEX mode might create a bunch of problems with other desireable OpenGL
features? A texture map solution might not be so bad after all!?

   Dave P



|---------+---------------------------->
|         |           Rainer Sabelka   |
|         |           <sabelka at iue.tuwi|
|         |           en.ac.at>        |
|         |           Sent by:         |
|         |           vtkusers-admin at vt|
|         |           k.org            |
|         |                            |
|         |                            |
|         |           04/05/2004 06:30 |
|         |                            |
|---------+---------------------------->
  >--------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                                |
  |       To:       "de Boer Ingo" <I.deBoer at polytec.de>                                                                           |
  |       cc:       vtkusers at public.kitware.com                                                                                    |
  |       Subject:  Re: [vtkusers] Re: Scalar color / LookupTable / Interpolation problem...                                       |
  >--------------------------------------------------------------------------------------------------------------------------------|




On Monday 03 May 2004 09:45, de Boer Ingo wrote:
> Hi,
>
> > To bypass OpenGL's  interpolation of colors I used a texture
> > map instead of a lookup table.
>
> It is not OpenGL's  interpolation of colors, it is VTK's
> interplation. I have it working in plain OpenGL. Look at
> my picture, I posted on friday.

Well, I'm not an expert in OpenGL, but I suspect you somehow told OpenGL to

use your own lookup table (I just discovered the function glColorTable() in

the OpenGL reference).

> I don't understand, why VTK does not use that. It makes
> our project senseless, when we have other values displayed.
> And looking at the replies, I am not the only one having
> trouble with that...

It seems that VTK uses its LookupTables only for determining the colors of
the
cell corners, but does not share this information with OpenGL, and
therefore
the interior of the cells is rendered by interpolation the RGBA values of
the
corners.

I have no idea how much effort it would be implementing such a feature
(without breaking other stuff), but it would definitely be much
appreciated.
Otherwise one has to stick with the work-around using texture maps, which
is
not very elegant (and maybe not as efficient).

cheers
-Rainer
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: <
http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers

_







More information about the vtkusers mailing list