Hi all, I am relatively new to Vtk and have a rather basic question. I am trying to display a colored iso-surface plot of an array of scalar values given at the points of a rectangular grid. Below is my code, the result of which is a white plane with the geometry of the object (it is a 2D grid) I am trying to visualize. My basic question is of course : What's wrong? What am I missing? Is there a basic example of how this should be done? My understanding is that I make vtkPolyData out of the vtkRectilinearGrid using the filter, then add the scalar array I am trying to plot over the grid as a vtkDataArray to the vtkPointData of this vtkPolyData. Finally assign it to be recognized as POINT_DATA and then plot the thing using the default lookup table (which also looks really wrong btw.) Vector is a simple Vector class that has a T * operator() - and a size() function, nothing too special... void SnapshotView2D::plot(const Vector & xc, const Vector & yc, const Vector & zc, const Vector & data) { const int n1=xc.size(), n2=yc.size(), n3=zc.size(); vtkSmartPointer xCoords = vtkFloatArray::New(); xCoords->SetArray(const_cast&>(xc),xc.size(),1); vtkSmartPointer yCoords = vtkFloatArray::New(); yCoords->SetArray(const_cast&>(yc),yc.size(),1); vtkSmartPointer zCoords = vtkFloatArray::New(); zCoords->SetArray(const_cast&>(zc),zc.size(),1); vtkSmartPointer scalars = vtkFloatArray::New(); scalars->SetArray(const_cast&>(data),data.size(),1); scalars->SetName("scalars"); vtkSmartPointer rgrid = vtkRectilinearGrid::New(); rgrid->SetDimensions(n1,n2,n3); rgrid->SetXCoordinates(xCoords); rgrid->SetYCoordinates(yCoords); rgrid->SetZCoordinates(zCoords); plane = vtkRectilinearGridGeometryFilter::New(); plane->SetInput(rgrid); plane->SetExtent(0,n1-1,0,n2-1, 0,n3-1); vtkPolyData * planeData = plane->GetOutput(); vtkPointData * pointData = planeData->GetPointData(); pointData ->AddArray(scalars); vtkAssignAttribute * assign = vtkAssignAttribute::New(); assign->SetInput(planeData); assign->Assign("scalars", vtkDataSetAttributes::SCALARS, vtkAssignAttribute::POINT_DATA); assign->Update(); vtkSmartPointer pLookupTable = vtkSmartPointer::New(); // pLookupTable->SetTableRange(planeData->GetScalarRange()); pLookupTable->SetNumberOfTableValues(10); // pLookupTable->SetHueRange(0.667,0.0); // pLookupTable->SetValueRange(0.0,1.0); pMapper = vtkPolyDataMapper::New(); pMapper->SetInput(planeData); pMapper->ImmediateModeRenderingOn(); pMapper->ScalarVisibilityOn(); pMapper->SetScalarModeToUsePointData(); pMapper->SetScalarRange(planeData->GetScalarRange()); pMapper->SetLookupTable(pLookupTable); // Create a scalar bar vtkScalarBarActor * scalarBar = vtkScalarBarActor::New(); scalarBar->SetLookupTable(pLookupTable); // scalarBar SetTitle "Temperature" // [scalarBar GetPositionCoordinate] SetCoordinateSystemToNormalizedViewport // [scalarBar GetPositionCoordinate] SetValue 0.1 0.01 // scalarBar SetOrientationToHorizontal // scalarBar SetWidth 0.8 // scalarBar SetHeight 0.17 pActor = vtkActor::New(); pActor->SetMapper(pMapper); // pActor->GetProperty()->SetRepresentationToWireframe(); // pActor->GetProperty()->SetColor(0,0,0); pRenderer->AddActor(scalarBar); pRenderer->AddActor(pActor); pRenderer->SetBackground(1,1,1); pRenderer->ResetCamera(); pRenderWindow->Render(); pRenderer->SetBackground(0.9,0.9,0.9); // Background color white vtkAxesActor * pAxes = vtkAxesActor::New(); vtkOrientationMarkerWidget * pWidget = vtkOrientationMarkerWidget::New(); pWidget->SetOutlineColor( 0.9300, 0.5700, 0.1300 ); pWidget->SetOrientationMarker( pAxes ); pWidget->SetInteractor(pRenderWindowInteractor); pWidget->InteractiveOff(); // Reset camera pRenderer->ResetCamera(); pRenderWindow->Render(); pWidget->SetEnabled( 1 ); pRenderWindowInteractor->Start(); } I would be greatful if you could point me to an example, I had assumed that this is one of the most basic things one could do in Vtk. Best regards and many thanks Roland _______________________________________________ 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://www.vtk.org/mailman/listinfo/vtkusers