[vtkusers] Why two scalar volume rendering failed???

Enya Shen enya.shen2010 at gmail.com
Thu Mar 20 10:56:15 EDT 2014


I get nothing error message. And I only don't see any opacity!

The range of the first scalar is about [0, 12]. And the second is [0,1].

I am really confused.


2014-03-20 22:33 GMT+08:00 Aashish Chaudhary <aashish.chaudhary at kitware.com>
:

>
> On Thu, Mar 20, 2014 at 10:27 AM, Enya Shen <enya.shen2010 at gmail.com>wrote:
>
>> Hi all,
>>
>> I tried to use different scalar for color and opacity in volume rendering
>> as follows. But it failed to use the second scalar to get opacity. Why?
>> Thank you for any advice!!!
>>
>> ......
>>
>> vtkPiecewiseFunction* opacityFn = vtkPiecewiseFunction::New();
>>
>> vtkColorTransferFunction* colorFn = vtkColorTransferFunction::New();
>>
>>
>> vtkVolumeProperty* volumeProperty = vtkVolumeProperty::New();
>>
>> volumeProperty->SetIndependentComponents(false);
>>
>> volumeProperty->SetScalarOpacity(this->opacityFn);
>>
>> volumeProperty->SetColor(this->colorFn);
>>
>> volumeProperty->SetInterpolationTypeToLinear();
>>
>> volumeProperty->ShadeOn();
>>
>>
>> vtkVolume* volumeActor = vtkVolume::New();
>>
>> volumeActor->SetProperty(this->volumeProperty);
>>
>>
>> colorFn->AddRGBPoint(this->scalarsRange[0][0], 0.0, 0.0, 1.0);
>>
>> colorFn->AddRGBPoint(0.5*(this->scalarsRange[0][0]+this->scalarsRange[0][1]), 0.0, 1.0, 0.0);
>>
>> colorFn->AddRGBPoint(this->scalarsRange[0][1], 1.0, 0.0, 0.0);
>>
>> opacityFn->AddPoint(this->scalarsRange[1][0], 0.0, 0.0, 0.0);
>>
>> opacityFn->AddPoint(0.5*(this->scalarsRange[1][0]+this->scalarsRange[1][1]), 0.5, 0.0, 0.0);
>>
>> opacityFn->AddPoint(this->scalarsRange[1][1], 1.0, 0.0, 0.0);
>>
>> volumeProperty->SetIndependentComponents(true);
>>
>>
>
> Did you get any error or its just that you don't see any opacity?  What
> are the ranges? I may have to look at the VTK code
> and your data to provide a solution.
>
> - Aashish
>
>>
>> ......
>>
>>
>> Regards,
>>
>> Enya
>>
>>
>> _______________________________________________
>> 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
>>
>>
>
>
> --
> | Aashish Chaudhary
> | R&D Engineer
> | Kitware Inc.
> | www.kitware.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140320/45ebeeaf/attachment.html>


More information about the vtkusers mailing list