[vtkusers] Unstructured grid renderer artefacts ?
Moreland, Kenneth
kmorel at sandia.gov
Fri Sep 23 10:32:21 EDT 2005
I'm re-sending this messages with the attachments stripped off.
-Ken
> -----Original Message-----
> From: Moreland, Kenneth
> Sent: Friday, September 23, 2005 8:25 AM
> To: 'Zsolt '; vtkusers at vtk.org
> Subject: RE: [vtkusers] Unstructured grid renderer artefacts ?
>
> Zsolt,
>
> Your problems stem from the fact that unstructured grid
> volume rendering was still in its infancy for the release of
> VTK 4.4. Your problems can probably be solved by upgrading
> to VTK 5.0 (which should have a beta release very soon). The
> small pink dots you see are an artifact from approximations
> made during ray integration. These approximations lead to
> artifacts when you have sharp changes in color and opacity,
> as you have in your data. The ray integration is much
> improved in VTK 5.0 and these artifacts should go away. See
> the attached ball.png.
>
> The white dots and lines you see in the axis aligned view are
> caused by a bug in vtkUnstructuredGridVolumeRayCastMapper
> (well, technically in its helper class
> vtkUnstructuredGridBunykRayCastFunction). It is a numerical
> instability that occurs when a ray hits exactly at an edge or
> point of a cell and then traverses into the incorrect
> neighbor. This bug still exists in VTK 5.0, but you also
> have a choice of mappers now.
> vtkUnstructuredGridZSweepMapper is slightly slower, but uses
> far less memory and does not have the numerical instabilities
> that the ray cast mapper can have. There is also
> vtkProjectedTetrahedraMapper. It is much faster than the
> other two methods (especially if you have a graphics card),
> but it takes many liberties in its color computations, so
> your "little pink dot" artifacts actually become much worse
> (see the attached ball_pt.png).
>
> -Ken
>
> > -----Original Message-----
> > From: vtkusers-bounces+kmorel=sandia.gov at vtk.org
> > [mailto:vtkusers-bounces+kmorel=sandia.gov at vtk.org] On
> Behalf Of Zsolt
> > Sent: Friday, September 23, 2005 5:53 AM
> > To: vtkusers at vtk.org
> > Subject: [vtkusers] Unstructured grid renderer artefacts ?
> >
> > 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