<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Dear All,<br><br>I am writing some C++ DLLs which use VTK to render a surface.&nbsp; I want to set the color of each facet using an array of RGB values passed to the function, although I only have code examples using scalar values.<br>After some reading, I see that there is huge potential to do this (e.g.  vtkColorTransferFunction), but I am getting out of my depth (jumping around the VTK class tree like a headless chicken!), and hope there is a simple way to do this.<br><br>Below is a sketch of the code that works with scalar mapping (presumably with the default color-map):<br>---<br><br>#include &lt;vtkPolyData.h&gt;<br>...<br><br>dcolarr = vtkDoubleArray::New();<br>dcolarr-&gt;SetArray(dcolors,nfaces,1); //<br><br>vtkPoints *sverts = vtkPoints::New();<br>vtkCellArray *sfaces = vtkCellArray::New();<br>...<br>vtkPolyData *surf =
 vtkPolyData::New();<br>surf-&gt;SetPoints(sverts);<br>surf-&gt;SetPolys(sfaces);<br>surf-&gt;GetCellData()-&gt;SetScalars(dcolarr); //<br><br>vtkDataSetMapper::SetResolveCoincidentTopologyToPolygonOffset();<br>vtkPolyDataMapper *surfMapper = vtkPolyDataMapper::New();<br>vtkActor *surfActor = vtkActor::New();<br>vtkRenderer *aRenderer = vtkRenderer::New();<br>vtkRenderWindow *renWin = vtkRenderWindow::New();<br>vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<br><br>surfMapper-&gt;SetInput(surf);<br>surfMapper-&gt;ScalarVisibilityOn(); //<br>surfMapper-&gt;SetScalarRange(0,1); //<br><br>surfActor-&gt;SetMapper(surfMapper);<br>aRenderer-&gt;AddActor(surfActor);<br>iren-&gt;SetRenderWindow(renWin);<br><br>renWin-&gt;AddRenderer(aRenderer);<br>renWin-&gt;SetSize(500,500);<br>renWin-&gt;Render();<br><br>vtkInteractorStyleTrackballCamera *style =
 vtkInteractorStyleTrackballCamera::New();<br>iren-&gt;SetInteractorStyle(style);<br><br>iren-&gt;Start();<br>...<br><br>---<br><br>Could someone please advise how to modify this (I guess, in particular the lines ending with '//') to take an array of RGB values (0-1, 0-255, whatever...) for the facet colors?<br><br>With kind regards,<br>MT<br><br></td></tr></table><br>