[vtkusers] The color of the triangle mesh is affected after I call SetScalars

Jogging Song joggingsong at gmail.com
Wed Aug 27 23:19:35 EDT 2014

Thanks for your timely reply, Cory.
After reading some code of VTK, maybe I find the reason. When VTK reads one
ply mesh with color, the color information is stored in scalars field of
vtkPointData. I hope to find the shortest path with weight on the mesh.
In the implementation of vtkDijkstraGraphGeodesicPath, the weight is
obtained from scalar field of the vtkPolyData.
So when I set the scalars, the color information of the mesh is
overwritten.  I can only store color information or weight information, but
not simultaneously.

Is there one way to use the color information and weight information at the
same time?

Jogging Song

On Wed, Aug 27, 2014 at 9:01 PM, Cory Quammen <cory.quammen at kitware.com>

> Jogging,
> Without seeing any code, it's tough to tell you where to make the
> change. I'll assume you have a vtkMapper (or subclass) somewhere in
> your code, and I'll assume C++. To disable coloring by the scalar
> value, call
> mapper->ScalarVisibilityOff();
> I hope that helps,
> Cory
> On Wed, Aug 27, 2014 at 4:03 AM, Jogging Song <joggingsong at gmail.com>
> wrote:
> > Hi, all
> >
> > I read one triangle mesh file from the disk. The mesh itself contains
> color
> > information. I can render the mesh correctly.  The color of rendered
> mesh is
> > from the color information of the mesh. To use the scalars, I call the
> > function SetScalars.  The color of the rendered mesh is changed and now
> the
> > color is from scalars. However I hope to use the color of the mesh. I can
> > find the answer from the internet. Can anyone help me?
> >
> > Regards
> > Jogging Song
> >
> > _______________________________________________
> > 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
> >
> > 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/20140828/32c053f8/attachment.html>

More information about the vtkusers mailing list