[vtkusers] Transparency issue beetween actors
Bertrand de Boisdeffre
bertrand.boisdeffre at gmail.com
Thu Aug 19 06:06:22 EDT 2010
Sorry, i make a mistake, my code was the following :
vtkPolyDataMapper.SetResolveCoincidentTopologyToPolygonOffset();
vtkPolyDataMapper sliceMapper = vtkPolyDataMapper.New();
sliceMapper.SetInput(plane.GetOutput());
2010/8/19 Bertrand de Boisdeffre <bertrand.boisdeffre at gmail.com>
>
>
> 2010/8/19 Bertrand de Boisdeffre <bertrand.boisdeffre at gmail.com>
>
> I tried this code (maybe wrong):
>>
>> vtkPolyDataMapper.SetSetResolveCoincidentTopologyToPolygonOffset()
>> slicemapper= vtkPolyDataMapper.New();
>> sliceMapper.SetInput( "");
>> ...
>>
>> but it doesn't resolve my problem. However, this method is static and i
>> don't know if i have to call it as I do in my code.
>>
>> 2010/8/19 Jothy <jothybasu at gmail.com>
>>
>> Try setting .SetResolveCoincidentTopologyToPolygonOffset in the
>>> vtkPolyDataMapper.
>>>
>>>
>>> Jothy
>>>
>>> On Thu, Aug 19, 2010 at 9:18 AM, Bertrand de Boisdeffre <
>>> bertrand.boisdeffre at gmail.com> wrote:
>>>
>>>> Hi,
>>>> I have an issue about actors transparency. I try to display in a 3D
>>>> scene, some volumes ( vtkPolyData are the source) intersected by a plane
>>>> which has an image texture.
>>>> I manage to display correctly all my actors, but when i set an actor
>>>> opacity to a value different to 1, if this actor is located beetween the
>>>> camera and the "image plane", it diseapears.
>>>>
>>>> Here is my code to built my "image plane":
>>>>
>>>> vtkActor sliceActor = new vtkActor();
>>>> // ImageSlice full path
>>>> string imageFullPath =
>>>> System.IO.Path.GetFullPath(xmlBinding.GetSlice(XmlSlice.SliceRef).pictureRelativePathWithOverlays);
>>>>
>>>>
>>>> // Read the file
>>>> vtkPNGReader imageReader = new vtkPNGReader();
>>>> if(System.IO.File.Exists(imageFullPath))
>>>> {
>>>> imageReader.SetFileName(imageFullPath);
>>>> imageReader.Update();
>>>>
>>>> vtkPlaneSource plane = vtkPlaneSource.New();
>>>> plane.SetOrigin(0, 0, 0);
>>>>
>>>> if (XmlSlice.SliceRef != 0)
>>>> {
>>>> plane.SetPoint1(511 * THOutline.PIXELSIZE, 0, 0);
>>>> plane.SetPoint2(0, 0, -674 * THOutline.PIXELSIZE);
>>>> plane.SetXResolution(1);
>>>> plane.SetYResolution(1);
>>>>
>>>> }
>>>> else
>>>> {
>>>> plane.SetPoint1(0, 511 * THOutline.PIXELSIZE, 0);
>>>> plane.SetPoint2(0, 0, -674 * THOutline.PIXELSIZE);
>>>> plane.SetXResolution(1);
>>>> plane.SetYResolution(1);
>>>> }
>>>> plane.SetCenter(XmlSlice.SlicePos.Xum,
>>>> XmlSlice.SlicePos.Yum, XmlSlice.SlicePos.Zum + (674 * THOutline.PIXELSIZE /
>>>> 2 - this.GetFocalPositionImageTopUm()));
>>>>
>>>> vtkPolyDataMapper sliceMapper = vtkPolyDataMapper.New();
>>>> sliceMapper.SetInput(plane.GetOutput());
>>>>
>>>>
>>>>
>>>> sliceActor.SetMapper(sliceMapper);
>>>>
>>>> vtkTexture sliceTexture = vtkTexture.New();
>>>> sliceTexture.SetInput(imageReader.GetOutput());
>>>> sliceTexture.InterpolateOn();
>>>> sliceTexture.SetQualityTo32Bit();
>>>>
>>>> sliceActor.SetTexture(sliceTexture);
>>>>
>>>> }
>>>> return sliceActor;
>>>>
>>>> So the image is correctly display, but if i had an a other actor as in
>>>> this schema (top view):
>>>>
>>>> _________ :
>>>> image slice actor
>>>>
>>>> 00000000000 :
>>>> "volume actor"
>>>>
>>>>
>>>> -
>>>> |
>>>> | : camera
>>>>
>>>>
>>>> if volume actor opacity = 1, all work well.
>>>> if volume actor opacity != 1 =>
>>>>
>>>> _________ : image slice actor
>>>>
>>>>
>>>> 0 00 : "volume actor"
>>>>
>>>>
>>>> -
>>>> | | : camera
>>>>
>>>>
>>>> I make some researches on web, and i found (maybe) a solution : using
>>>> "vtkDephtSortPolyData but I am not sure to know how it works ( and maybe it
>>>> is not the solution) .
>>>>
>>>> So i ask your help.
>>>>
>>>> Best Regards,
>>>> --
>>>> Bertrand de Boisdeffre
>>>> Etudiant 2A SICOM Phelma Grenoble-INP
>>>>
>>>>
>>>> _______________________________________________
>>>> 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
>>>>
>>>>
>>>
>>
>>
>> --
>> Bertrand de Boisdeffre
>> Etudiant 2A SICOM Phelma Grenoble-INP
>>
>>
>
>
> --
> Bertrand de Boisdeffre
> Etudiant 2A SICOM Phelma Grenoble-INP
>
>
--
Bertrand de Boisdeffre
Etudiant 2A SICOM Phelma Grenoble-INP
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100819/d5993165/attachment.htm>
More information about the vtkusers
mailing list