[vtkusers] Transparency issue beetween actors

Bertrand de Boisdeffre bertrand.boisdeffre at gmail.com
Thu Aug 19 09:14:03 EDT 2010


The language what i use is C#. I can't call a class static method, with an
object of this class. The call of these methods have to be like this :

ClassName.StaticMethod();

// this code is wrong
Class classObject = new Class();
classObject.StaticMethod();

2010/8/19 Jothy <jothybasu at gmail.com>

> What about setting
> sliceMapper->SetSetResolveCoincidentTopologyToPolygonOffset() ?
>
> Jothy
>
>
> On Thu, Aug 19, 2010 at 11:03 AM, Bertrand de Boisdeffre <
> bertrand.boisdeffre at gmail.com> wrote:
>
>>  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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100819/8a169740/attachment.htm>


More information about the vtkusers mailing list