[vtkusers] How color works

David Doria daviddoria+vtk at gmail.com
Fri Jan 29 16:38:09 EST 2010


On Fri, Jan 29, 2010 at 4:03 PM, Kenneth Porter <shiva at sewingwitch.com> wrote:
> I want to create a color-by-height image and I'm looking at this example:
>
> <http://www.vtk.org/Wiki/VTK/Examples/Color_a_mesh_by_height>
>
> I created this in ParaView by applying a Delaunay2D to my X/Y/Z point cloud
> of height readings off a surface:
>
> <http://sewingwitch.com/ken/Stuff/HeightExample.png>
>
> The scalar array that establishes the colors is presumably associated with
> each vertex. I'm guessing that each triangle can only have a single color,
> not a continuous shading from low to high scalar value. How does the color
> of each triangle get chosen?
>
> To get a more smooth gradation, I'd guess I need to resample the surface at
> higher resolution to get more triangles, and then apply new colors to each
> triangle. I'd need to synthesize a new scalar array with intermediate values
> matching each triangle's "height". Is that true?


The coloring of the triangle will be interpolated like you're looking
for if you assign the color to the PointData. See this example:
http://www.vtk.org/Wiki/VTK/Examples/TriangleColoredPoints

A single color triangle is achieved by adding the color to the
CellData, as in this example:
http://www.vtk.org/Wiki/VTK/Examples/TriangleSolidColor

Hope that helps,

David



More information about the vtkusers mailing list