[vtk-developers] Rendering scalar data with NaNs

Moreland, Kenneth kmorel at sandia.gov
Mon Aug 23 18:30:25 EDT 2010


I've recently run into an issue with rendering fields with NaN values in it.  In this case, the data comes from a simulation that intentionally writes out NaN values, which have a significant meaning.  The problem is that the current VTK rendering classes have no control over what color the NaN values map to, and I have noticed that different hardware maps them differently.

Thus, I propose making the changes in the attached patches (created with git-format-patch).  First, a NanColor was added to vtkLookupTable (as a 4-tuple RGBA) and added to vtkColorTransferFunction (as a 3-tuple RGB) so that these respective lookup tables would return a specific color for NaN.  Next, vtkScalarsToColorsPainter was modified to use a 2D texture map that uses the second dimensions to distinguish between real and NaN values.  I also added a test for rendering these NaN values along with the other non-finite -INF and INF values.

Does anyone object to these changes, or do they seem reasonable to put into VTK?

-Ken

   ****      Kenneth Moreland
    ***      Sandia National Laboratories
***********
*** *** ***  email: kmorel at sandia.gov
**  ***  **  phone: (505) 844-8919
    ***      web:   http://www.cs.unm.edu/~kmorel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20100823/f4a90fc0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Added-test-for-rendering-non-finite-scalars.patch
Type: application/octet-stream
Size: 5697 bytes
Desc: 0001-Added-test-for-rendering-non-finite-scalars.patch
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20100823/f4a90fc0/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Add-NaN-color-to-vtkLookupTable.patch
Type: application/octet-stream
Size: 13804 bytes
Desc: 0002-Add-NaN-color-to-vtkLookupTable.patch
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20100823/f4a90fc0/attachment-0005.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-vtkScalarsToColorsPainter-supports-NaN-in-texture-lo.patch
Type: application/octet-stream
Size: 8213 bytes
Desc: 0003-vtkScalarsToColorsPainter-supports-NaN-in-texture-lo.patch
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20100823/f4a90fc0/attachment-0006.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-Add-NaN-color-to-vtkColorTransferFunction.patch
Type: application/octet-stream
Size: 4533 bytes
Desc: 0004-Add-NaN-color-to-vtkColorTransferFunction.patch
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20100823/f4a90fc0/attachment-0007.obj>


More information about the vtk-developers mailing list