Heh this is not a trivial problem.  Its hard to solve without a more specific specification of what you want to see.  Do you want the intersection highlighted or just visible?  If you have two objects that intersect (assuming both are usually opaque) do you want one to become translucent so you can see the opaque piece of one of the objects?  And how do you pick which one is made to see through?  Now expand the problem to multiple objects and it becomes more complicated.  Then there are the other cases like one object actually containing another object.
 
In any event, having lots of shapes, one per triangle is not the way to do.  I think there are several categories of solutions:
 
1.  Use dynamic geometry (geometry updator) and adjust the colors and alpha of the vertices.  This way you can completely control the transparency and color of all the triangles. 
 
2. Render everything in multiple passes using an ordered group.  Make everything at least partially transparent and use an additive blending model so that intersections are blended at higher brightness.
 
3. Render everything partially transparent, then re-render the sub-objects which represent the portion of the models whiich intersect.  In the second pass you could render the sub-objects opaque.
 
Good luck, it is an interesting problem.
 
Dave Yazel
 
 -----Original Message-----
From: RWGRAY [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 13, 2001 9:10 AM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] Transparency

To make transparency work correctly when objects intersect each other (so you can see the intersection part), how do you setup the object?
 
1) Do you have 1 Group node with **many** Shape3D's attached to the Group node, one Shape3D for each little triangle of the objects (many hundreds Shape3Ds)?
 
2) Or do you have 1 Group node with 1 Shape3D node which has *many* TriangularArray, one for each little triangle (many hundreds TriangularArray)?
 
3) Or is there some other way to define an object such that each triangle is considered "independent" and will result in correct transparency rendering when intersecting other such objects (with zbuffering set to order the rendering of each little triangle)?  
 
For example, I have a sphere through which I intersect a cylinder and a torus.  All objects are partially in and partially out of the other objects.  Setting the transparency, I want to see the intersecting parts.  What is the best way to define the geometry that will make this happen?
 
What is the performance hit going to be when having hundreds of Shape3Ds or TriangularArrays or whatever *per* geometric object?!
 
Bob Gray
 
 

Reply via email to