[vtk-developers] issue 7887 revisited

Andreas Buykx A.Buykx at tnodiana.com
Fri Jun 7 11:37:10 EDT 2013


Hi all,

Last few days I've been struggling to find the cause of a strange contouring effect caused, I think, by vtkMapper::MapScalarsToTexture()

    // Get the texture map from the lookup table.
    // Create a dummy ramp of scalars.
    // In the future, we could extend vtkScalarsToColors.
    double k = (range[1]-range[0]) / (ColorTextureMapSize-1);
    vtkFloatArray* tmp = vtkFloatArray::New();
    tmp->SetNumberOfTuples(ColorTextureMapSize);
    float* ptr = tmp->GetPointer(0);
    for (int i = 0; i < ColorTextureMapSize; ++i)
      {
      *ptr = range[0] + i * k;
      ++ptr;
      }

I set the color scale to have 3 colors, and, as you can see, when using color interpolation before mapping, I get 2 almost identical greens, neither of which matches the green of the color scale. This happens only when I run our application under  Windows remote desktop. When I run a local installation on Windows, or a VNC session on Linux, the colors are fine.

I accidentally came across issue 7887 while studying vtkContourValues::GenerateValues()

    for (i= 0; i < numContours; ++i)
      {
      // no we cannot factorize the ratio
      // (range[1] - range[0])/(numContours - 1) out of the loop.
      // we want the whole expression to be evaluated on the FPU.
      // see bug discussion: http://www.vtk.org/Bug/view.php?id=7887
      this->SetValue(i, range[0] + i*(range[1] - range[0])/(numContours - 1));
      }

The same loop occurs in said method of vtkMapper but here the multiplier is calculated outside the loop.  I suspect that this may cause the difference in behavior. I have no way for testing it though. Could someone please try to reproduce? Should I file this as an issue in mantis?
Thanks a lot,

Andreas Buykx
Senior Software Engineer

TNO DIANA BV
Software Developers and Analysis Consultants for Civil and Geotechnical Engineering

Delftechpark 19a, 2628 XJ, Delft, The Netherlands
Tel: +31 88 34262 15 (Direct) │ Tel: +31 88 34262 00 (Switchboard) │ +31 88 34262 99 (Fax)
http://tnodiana.com<http://tnodiana.com/>

...be green keep it on screen

____________________________________________________________
TNO DIANA BV is a limited liability company registered in the trade register of the Chamber of Commerce as TNO DIANA BV with registered number 27252655.
____________________________________________________________
This e-mail and its contents are subject to the DISCLAIMER at http://tnodiana.com/content/Disclaimer
____________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20130607/1fb438bc/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: InterpolateBeforeMappingOff.png
Type: image/png
Size: 17013 bytes
Desc: InterpolateBeforeMappingOff.png
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20130607/1fb438bc/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: InterpolateBeforeMappingOn.png
Type: image/png
Size: 12455 bytes
Desc: InterpolateBeforeMappingOn.png
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20130607/1fb438bc/attachment-0003.png>


More information about the vtk-developers mailing list