[vtkusers] question regard transparency

Benjamin King king.benjamin at mh-hannover.de
Wed Oct 22 12:00:44 EDT 2003


Hi Luke,

Your code looks good and I can't see why it doesn't produce the correct 
results. What you can try to do next is to examine if the vtkContourFilter 
does what it should do. I would try the following:

0) Let's say you name the brainActor->GetProperty() object frontProperty
1) Construct a new vtkProperty backProperty with another color than 
frontProperty
2) Make them both fully opaque

3) backProperty->FrontFaceCullingOn(); backProperty->BackFaceCullingOff();
4) brainActor->SetBackFaceProperty(backProperty)

5) Now your object has different colors on both sides. You could check if 
you see the color from the inside on the outside - which would be bad. And 
you could add a clipping plane to the brainMapper and see if there are 
structures on the inside that you don't want there.

If everything looks as expected, the funny picture might result from the 
backface culling:
                    _    _
                   / \  / \   <-unculled surface
camera   o        /   \/   \
                  |        /
                   \______/

whould be culled to
                          /    /     <-culled surface
camera   o        /    /    |         \

so maybe it looks better if you don't use backface culling.


> I do try to use vtkDepthSortPolyData filter in my pipeline. However, it 
> does not remove those white matter, instead it drastically slow my 
> program. So, I disabled it.

Yes the program will definitly be slower. If there is no difference in 
visual appearence for you, then you can safely switch it off. But there 
will be some difference if you move the camera around.


> Is there any difference between setbackfaceculling(int) and 
> backfacecullingon()? And what the meaning of the int.

SetBackFaceCulling(1) = BackFaceCullingOn();
SetBackFaceCulling(0) = BackFaceCullingOff();

It should be a bool, I don't know why vtk uses an int. You'll see this in 
many filters because they provided some helpful macros (in vtkSetGet.h) 
which create these methods.


> BTW: the purpose of my project is to draw something in the back of the 
> transpaent brain. I think remove the polygons in the back would not 
> affect the drawing as long as I put the actors in correct order.

Hmm. If the brain is transparent, you should see the polygons in the back. 
I'd really suggest that you leave them in, sort the polydata and look if 
the picture makes sense.


> Luke
> P.S. I construct the surface directly from the raw data. Would it help if 
> I first build the contour from the image than construct the surface using 
> those contours?

I'm not very experienced with the contour filters, but I think that your 
current solution performs better.


Hope it helps,
  Benjamin


-- 
Benjamin King
Institut für Medizinische Informatik
Medizinische Hochschule Hannover
Tel.: +49  511  532-2663



More information about the vtkusers mailing list