[vtkusers] Render scene without shading, light, interpolation

Jaehyun Jang sysexits at gmail.com
Wed Nov 30 02:20:32 EST 2016


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 <http://cgv.kaist.ac.kr/>
Resume <https://www.linkedin.com/in/silvesterjang> | Github
<https://github.com/sysexits> | Personal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161130/1269e2a8/attachment.html>


More information about the vtkusers mailing list