[vtkusers] Unstructured grid renderer artefacts ?

Lisa Avila lisa.avila at kitware.com
Wed Sep 28 17:01:40 EDT 2005


Hello Zsolt,

Unfortunately, I do know what is causing the problem. It is an issue with 
the algorithm used in the unstructured grid ray caster (based on a paper by 
Bunyk) which some times cannot determine the next cell (due to a degenerate 
intersection typically - enter on a tetra face but exit at a vertex, or 
things of that sort) The authors suggest noting when it occurs an filling 
in that pixel with a neighboring value - but that somehow seemed wrong to 
me. I need to find an alternate solution for those pixels - it is on my "to 
do" list....

For now - you can use an alternate rendering method - there are two 
available: vtkProjectedTetrahedraMapper and 
vtkUnstructuredGridVolumeZSweepMapper. The first is quite fast, but not 
quite as accurate as the ray caster (well, of course, except for those 
blank pixels!) and the second is similar accuracy, but a bit slower 
typically (but usually consumes less memory that the ray caster which is 
quite greedy in that regard)

Lisa



At 07:53 AM 9/23/2005, Zsolt wrote:
>Dear VTK users,
>
>I`m using VTK 4.4 under Visual C++ 7.1 for unstructured grid rendering and 
>I`m getting strange artefacts,
>like small dots in the results:
>    see link      http://www.sccg.sk/~toth/vtk/06.tiff
>or if it is viewed axis alligned:
>     see link     http://www.sccg.sk/~toth/vtk/18.tiff
>
>the dataset can be found at:   link: http://www.sccg.sk/~toth/vtk/input.vtk
>
>The code of the application:
>
>#include "vtkConeSource.h"
>#include "vtkPolyDataMapper.h"
>#include "vtkRenderWindow.h"
>#include "vtkRenderWindowInteractor.h"
>#include "vtkCamera.h"
>#include "vtkActor.h"
>#include "vtkRenderer.h"
>#include "vtkRendererSource.h"
>#include "vtkTIFFWriter.h"
>
>#include "vtkVolumeRayCastMapper.h"
>#include "vtkVolumeRayCastCompositeFunction.h"
>#include "vtkUnstructuredGridVolumeRayCastMapper.h"
>#include "vtkStructuredPoints.h"
>#include "vtkUnstructuredGridReader.h"
>#include "vtkDataReader.h"
>#include <stdio.h>
>
>#include "vtkPiecewiseFunction.h"
>#include "vtkColorTransferFunction.h"
>#include "vtkVolumeProperty.h"
>
>#include "vtkDataArray.h"
>#include "vtkErrorCode.h"
>#include "vtkFieldData.h"
>#include "vtkObjectFactory.h"
>#include "vtkPointData.h"
>#include "vtkStructuredPoints.h"
>#include <vtkUnsignedShortArray.h>
>#include "vtkCellData.h"
>
>#include <iostream>
>using namespace std;
>
>
>#include "vtkDataReader.h"
>
>
>int main( int argc, char *argv[] )
>{
>   // volume property
>   int shade = 0,
>           compos = 0,  //Classify First or Interpolate First
>           interp = 0;
>
>   // renderer
>   vtkRenderer *ren1= vtkRenderer::New();
>   ren1->SetBackground( 1.0, 1.0, 1.0 );
>
>   // render window
>   vtkRenderWindow *renWin = vtkRenderWindow::New();
>   renWin->AddRenderer( ren1 );
>   renWin->SetSize( 800, 600 );
>
>   // interactor
>   vtkRenderWindowInteractor *iren1 = vtkRenderWindowInteractor::New();
>   iren1->SetRenderWindow(renWin);
>
>   // set up the input file for unstructured grid reader
>   vtkUnstructuredGridReader *unstructuredReader 
> =vtkUnstructuredGridReader::New();
>   unstructuredReader->SetFileName("input.vtk");
>
>   // set up opacity transfer function
>   vtkPiecewiseFunction *opacityTransferFunction = 
> vtkPiecewiseFunction::New();
>   opacityTransferFunction->AddPoint(0,   0.02);
>   opacityTransferFunction->AddPoint(4095.0, 1.0);
>
>   // set up color transfer function
>   vtkColorTransferFunction *colorTransferFunction =
>           vtkColorTransferFunction::New();
>   colorTransferFunction->AddRGBPoint( 0.0, 0.1, 0.1, 0.1);
>   colorTransferFunction->AddRGBPoint( 4095.0, 1.0, 0.0, 1.0);
>
>   // set up volume property
>   vtkVolumeProperty *volumeProperty = vtkVolumeProperty::New();
>   volumeProperty->SetColor(colorTransferFunction);
>   volumeProperty->SetScalarOpacity(opacityTransferFunction);
>   volumeProperty->SetInterpolationType(interp);
>   volumeProperty->SetShade(shade);
>
>   // composite function for strucured grid renderer
>   vtkVolumeRayCastCompositeFunction *compositeFunction =
>           vtkVolumeRayCastCompositeFunction::New();
>   compositeFunction->SetCompositeMethod(compos);
>
>   //unstructuredGridRendering
>   vtkUnstructuredGridVolumeRayCastMapper *volumeUnstructedMapper = 
> vtkUnstructuredGridVolumeRayCastMapper::New();
>   volumeUnstructedMapper->SetInput(unstructuredReader->GetOutput());
>
>   vtkVolume *volume = vtkVolume::New();
>
>   volume->SetMapper(volumeUnstructedMapper);
>
>   volume->SetProperty(volumeProperty);
>
>   // add volume to renderer
>   ren1->AddVolume(volume);
>
>   renWin->Render();
>
>   iren1->Start();
>
>   ren1->Delete();
>   renWin->Delete();
>   iren1->Delete();
>   opacityTransferFunction->Delete();
>   colorTransferFunction->Delete();
>   volumeProperty->Delete();
>   compositeFunction->Delete();
>    // unstructured grid case
>   volumeUnstructedMapper->Delete();
>   unstructuredReader->Delete();
>   volume->Delete();
>
>   return 0;
>}
>
>Do You have any idea what can cause these problems?
>
>Many thanks, best regards
>                                            Zsolt
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: 
>http://www.vtk.org/Wiki/VTK_FAQ
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers





More information about the vtkusers mailing list