[vtkusers] need help about basic color mapping

Toron J. ji_wi at yahoo.com
Thu Nov 15 10:52:45 EST 2007


Hi,

I want to use color mapping to represent the temperature on a 3D surface. The surface mesh contains 900 vertices stored in an obj file. The temperature is related to the vertex ID like the following format in a txt file.
.....
50 87.4
51 85.2
52 74.9
53 78.3
54 80.6
.....

My code for drawing the surface (textured) is below, 
//*******************************************************
    vtkOBJReader *reader = vtkOBJReader::New();
    reader->SetFileName("surf.obj");

    vtkPolyDataNormals *normals = vtkPolyDataNormals::New();
    normals->SetInput(reader->GetOutput());

    vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
    mapper->SetInput(normals->GetOutput());

    vtkBMPReader *texReader = vtkBMPReader::New();
    texReader->SetFileName("textu.bmp");

    vtkTexture *texture = vtkTexture::New();
    texture->SetInput(texReader->GetOutput());

    vtkActor *actor = vtkActor::New();
    actor->SetTexture(texture);
    actor->SetMapper(mapper);

    vtkRenderer *renderer = vtkRenderer::New();
    renderer->AddActor(actor);

    vtkRenderWindow *renwindow = vtkRenderWindow::New();
    renwindow->AddRenderer(renderer);
    renwindow->SetSize(500, 500);
//**************************************************

I do not know how to convert the temperature data to color map on this surface. I have read rainbow.tcl but still do not understand it.  Does anyone can point out the procedure or show me any similar example?  Thanks a lot!

Toron

       
---------------------------------
Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20071115/4d0dd678/attachment.htm>


More information about the vtkusers mailing list