[vtkusers] Render scene without shading, light, interpolation

Ken Martin ken.martin at kitware.com
Wed Nov 30 09:35:54 EST 2016


Did you make sure none of the points were shared between cells? That would
cause issues.

Other than that you want

renWin->SetMultisamples(0);  // MSAA will create interpolated pixels
actor->GetProperty()->SetAmbient(1.0)
actor->GetProperty()->SetDiffuse(0.0)
actor->GetProperty()->SetSpecular(0.0)

and you should be good. Interpolation **should** be irrelevant if the
cell's points have the same color.



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 <http://cgv.kaist.ac.kr/>
> Resume <https://www.linkedin.com/in/silvesterjang> | Github
> <https://github.com/sysexits> | 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
>
>


-- 
Ken Martin PhD
Chairman & CFO
Kitware Inc.
28 Corporate Drive
Clifton Park NY 12065
518 371 3971

This communication, including all attachments, contains confidential and
legally privileged information, and it is intended only for the use of the
addressee.  Access to this email by anyone else is unauthorized. If you are
not the intended recipient, any disclosure, copying, distribution or any
action taken in reliance on it is prohibited and may be unlawful. If you
received this communication in error please notify us immediately and
destroy the original message.  Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161130/1a330c3c/attachment.html>


More information about the vtkusers mailing list