[vtkusers] Transparency issue beetween actors
Bertrand de Boisdeffre
bertrand.boisdeffre at gmail.com
Thu Aug 19 04:18:35 EDT 2010
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100819/12c035eb/attachment.htm>
More information about the vtkusers
mailing list