[vtkusers] Render scene without shading, light, interpolation

David E DeMarle dave.demarle at kitware.com
Wed Nov 30 08:36:57 EST 2016


You might also want to investigate vtkHardwareSelector. It internally does
what you are trying to do.
Another approach is the more recent vtkValuePass, which is more general but
if you associate an index array with the cells you can make it do the same
thing.

See the regression test suite for examples of use.



David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909

On Wed, Nov 30, 2016 at 8:29 AM, Cory Quammen <cory.quammen at kitware.com>
wrote:

> Hi,
>
> It seems like you are doing the right things and should expect to get
> the color values you set. Could you attach a small image showing the
> output you get and maybe highlight a cell that does not have the
> expected color? Are the colors way off from what you expect, or just
> slightly different?
>
> Thanks,
> Cory
>
> On Wed, Nov 30, 2016 at 2:20 AM, Jaehyun Jang <sysexits at gmail.com> wrote:
> > Dear vtk users,
> >
> > I am trying to these tasks using vtkPolyDataMapper with
> > vtkUnsignedCharArray, vtkRenderer, vtkRenderWindow to get pixel count of
> a
> > specific cell
> >
> > 1. Translate index value(within 1 ~ 16777215) to R, G, B value (using R =
> > idx & 255, G = (idx >> 8) & 255, B = (idx >> 16) & 255
> > 2. From all points of each cell, assigning those color values into
> > vtkUnsignedCharArray with SetTupleValue(point index of same cell, color)
> > (the forth value of color is always 255)
> > - i.e, All different cells have different RGB value. (If I set only 50
> cells
> > in the model, only 50 cells have distinct color in 1 ~ 50)
> > 3. Setting the model using vtkProperty with these settings
> >     m_actor->GetProperty()->BackfaceCullingOn();
> >     m_actor->GetProperty()->LightingOff();
> >     m_actor->GetProperty()->ShadingOff();
> >     m_actor->GetProperty()->SetInterpolationToFlat();
> >
> > 4. Render this model using vtkRenderWindow with these settings
> >     renderwindow->SetOffScreenRendering(1);
> >     renderwindow->AddRenderer(renderer);
> >     renderwindow->SetSize(600, 600);
> >     renderwindow->Render()
> > 5. Get vtkImageData using vtkWindowToImageFilter and access
> GetScalarPointer
> > 6. Translate RGB to index and count it.
> >
> > However, RGB values translate wrong indices which I did not expect, I
> want
> > to know how to set my renderer or actor without interpolation and
> shading to
> > get the expected color.
> >
> > Thanks.
> >
> > --
> > Jaehyun Jang
> > Master's candidate
> > School of Computing, KAIST
> > 291, Daehak-ro, Yuseong-gu, Daejeon
> > E3-1, 2413 STE
> > Computer Graphics and Visualization Lab
> > Resume | Github | Personal
> >
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the VTK FAQ at:
> > http://www.vtk.org/Wiki/VTK_FAQ
> >
> > Search the list archives at: http://markmail.org/search/?q=vtkusers
> >
> > Follow this link to subscribe/unsubscribe:
> > http://public.kitware.com/mailman/listinfo/vtkusers
> >
>
>
>
> --
> Cory Quammen
> Staff R&D Engineer
> Kitware, Inc.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161130/5463a574/attachment.html>


More information about the vtkusers mailing list