[vtkusers] VTK7.1: render points as spheres does not work when coloring by cell data

Ken Martin ken.martin at kitware.com
Thu Nov 10 08:30:39 EST 2016

Yes you can render the vertices using cell coloring but it is a bit odd.
Let me jump back a bit.

The sphere source produces triangles as cells. So the cell data will be one
color per triangle. The sphere source does not produce any cells that are
verts. The triangles have vertices which we can render but in VTKs
terminology they are not cells. The EdgeVisibility and VertexVisibility
makes the edges and vertices of cells visible but they themselves are not
cells, so no cell coloring.

Another way to see the issue is that a triangle consists of three
vertices.  Those vertices in turn are shared by typically 6 triangles each
with their own cell color. So there is no clear mapping of triangle cell
color to shared vertices, we have to use a cell to point filter or
something like that.

So how would you get cell data showing up on vertices? Well you need to
create verts as cells. SphereSource produces cells that are triangles.  But
you can use the GlyphFilter on any dataset with points to convert those
points into verts as follows.

sphereSource ss

// optionally if you have cell data on the triangles you can do a
CellToPoint filter
// to convert that to point data suitable for the next glyph filter.

glyph3dFilter glyph
glyphSource2d gs

// add cell data in here for the verts, one entry per vert

// Keep vertex visibility off

If you want the surface and the verts then add another mapper for the


Hope that helps!

On Wed, Nov 9, 2016 at 2:20 PM, lp <lotterluke at gmail.com> wrote:

> Hello,
> I am playing around with the new feature in vtk7.1 to render edges and
> vertices as tubes and spheres (as described in
> https://blog.kitware.com/rendering-tubes-and-spheres-in-vtk/).
> This is a very nice feature, but I have found one issue: When the mapper is
> set to color by cellData (mapper->SetScalarModeToUseCellData()), only the
> edges are shown as tubes but the spheres at the vertices are not rendered.
> For SetScalarModeToUsePointData it works as expected (both, tubes and
> spheres are rendered).
> So my question: Is it possible to show the vertex spheres, when coloring by
> cellData?
> Example code (based on VTK Sphere example) attached.
> Regards,
> Lukas
> CMakeLists.txt
> <http://vtk.1045678.n5.nabble.com/file/n5741121/CMakeLists.txt>
> Sphere.cxx <http://vtk.1045678.n5.nabble.com/file/n5741121/Sphere.cxx>
> --
> View this message in context: http://vtk.1045678.n5.nabble.
> com/VTK7-1-render-points-as-spheres-does-not-work-when-
> coloring-by-cell-data-tp5741121.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> 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/20161110/153f2942/attachment.html>

More information about the vtkusers mailing list