[vtkusers] Problem with very pixelated volume rendering

Shashwath T.R. trshash at gmail.com
Wed Jul 6 11:43:48 EDT 2011


Try turning on linear interpolation in the volume property...

volumeProperty->SetInterpolationTypeToLinear();

Shash

On Wed, Jul 6, 2011 at 7:22 PM, Tijmen Klein <T.R.Klein at student.rug.nl>wrote:

> I'm trying to create a volume rendering. The output seems to be ok, but is
> very pixelated. It seems like the sampling resolution is too low. I tried
> adjusting the imageSampleDistance and autoAdjustSampleDistances, but the
> result was the same. My basic code looks like this:
>
>
> volumeMapper = vtkSmartPointer<vtkGPUVolumeRayCastMapper>::New();
> volumeMapper->SetInputConnection(reader[1]->GetOutputPort());
>
> vtkSmartPointer<vtkVolumeProperty> volumeProperty =
> vtkSmartPointer<vtkVolumeProperty>::New();
>
> vtkSmartPointer<vtkPiecewiseFunction> compositeOpacity =
>  vtkSmartPointer<vtkPiecewiseFunction>::New();
> compositeOpacity->AddPoint(0.0,0.0);
> compositeOpacity->AddPoint(40.0,1.0);
> volumeProperty->SetScalarOpacity(compositeOpacity);
>
> vtkSmartPointer<vtkColorTransferFunction> color =
>  vtkSmartPointer<vtkColorTransferFunction>::New();
> color->AddRGBPoint(0.0 , 0.23,0.30,0.75);
> color->AddRGBPoint(40.0, 0.8 ,0.05 ,0.4);
> color->SetColorSpaceToDiverging();
> volumeProperty->SetColor(color);
>
> vtkSmartPointer<vtkVolume> volume = vtkSmartPointer<vtkVolume>::New();
> volume->SetMapper(volumeMapper);
> volume->SetProperty(volumeProperty);
>
> The volume is the added to a renderer (I have multiple vtkRenderers but
> only 1 vtkRenderWindow). I'm also using QT (qvtk widget).
> And since a picture says more than a 1000 words, an example of what is
> looks like: http://dl.dropbox.com/u/27566470/pixels.png
> This is a crop (without resize) of a screenshot from my running program.
> All other (non volume) elements look fine.
>
> Does anyone have any idea how to solve this?
>
>
> Cheers,
> Tijmen
>
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110706/ea41f7c4/attachment.htm>


More information about the vtkusers mailing list