[vtkusers] The color of the triangle mesh is affected after I call SetScalars
Cory Quammen
cory.quammen at kitware.com
Mon Sep 1 21:08:59 EDT 2014
In fact, you CAN store the color and weight information at the same
time, as long as they have different names. I don't know what the PLY
writer names its scalars, nor do I know what the
vtkDijkstraGraphGeodesicPath names its scalars outputs. If the reader
and filter do not assign a name to their output scalar arrays, then
indeed the colors from the PLY writer will be overwritten by the
scalars from vtkDijkstraGraphGeodesicPath.
Is it possible to post a small, self-contained piece of code that
shows what you are trying to do, and a small representative PLY file?
That will make it easier to guide you on what needs to be done.
Thanks,
Cory
On Wed, Aug 27, 2014 at 11:19 PM, Jogging Song <joggingsong at gmail.com> wrote:
> 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?
>
> Regards
> Jogging Song
>
>
> On Wed, Aug 27, 2014 at 9:01 PM, Cory Quammen <cory.quammen at kitware.com>
> wrote:
>>
>> 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
>> >
>
>
More information about the vtkusers
mailing list