[vtkusers] Problem with very pixelated volume rendering

Tijmen Klein T.R.Klein at student.rug.nl
Thu Jul 7 04:28:30 EDT 2011


Thanks a lot, this solved the problem!

Tijmen

On Wed, Jul 6, 2011 at 5:43 PM, Shashwath T.R. <trshash at gmail.com> wrote:

> 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/20110707/4fb9b0c1/attachment.htm>


More information about the vtkusers mailing list