Hi Bob, >Delivered-To: [EMAIL PROTECTED] >MIME-Version: 1.0 >Content-Transfer-Encoding: 7bit >X-Priority: 3 (Normal) >X-MSMail-Priority: Normal >X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 >Importance: Normal >Date: Wed, 2 Jan 2002 18:11:31 -0500 >From: RWGRAY <[EMAIL PROTECTED]> >Subject: [JAVA3D] Transparency Bug Report???? >Comments: To: Kelvin Chung <[EMAIL PROTECTED]> >To: [EMAIL PROTECTED] > >Hi Kelvin, > >Has a bug report been issued for any of the transparency problems I >demonstrate at >http://www.rwgrayprojects.com/Java3D/Transparency/trans01.html?? > >Toward the end of this web page shows the object as 3 different quadArrays, >and a very bad transparency problem. If you don't think this is a bug, >could you explain what the cause of the effect is and possibly suggest >another way to code it? > >Thanks, >Bob Gray > Seems to me the color of three toruses are green, blue, red from inside to outside. As you may know, the way Java3D doing depth sort is to compute the centroid of each GeometryArray and use the distance from the viewpoint. In the torus like shape there is a vertical part which connect the top and bottom. When view from the top, the distance from for all three (green/blue/red) of this vertical parts after you subdivide the torus are about the same to the viewer so the sorting order is not correct and green circle is seen. This is expected.
Breaking the geometry into 3,168 quadarrays and depth sort this one EVERY frame is going to be very slow if not memory expensive. For 30 of these object you are taking about sorting ~100K geometry EVERY frame. Using only one GeometryArray for a Shape3D under SharedGroup should have better memory usage. However it will not solve the transparency problem that you want. In general this is a hard problem without hardware support for depth sort per pixel or using stencil buffer (which Java3D do not support) technique. You can also try to simulate the effect if hardware support 3D texture as in Volume visualization. One thing you can try to do is instead of using BLEND_SRC_ALPHA for source blend function BLEND_ONE_MINUS_SRC_ALPHA for destination blend function, use BLEND_SRC_ALPHA for source blend function and BLEND_ONE for destination blend function instead. In this way there is no need to subdivide the torus and doing depth sorting since the effect after rendering is order independent. The drawback of this approach is that the effect is additive. i.e. the color of second layer will multiple by alpha1 and add to inner layer. The final color is the color of third layer multiple by alpha2 and add to the previous result. So you can only achieve the effect from dim to bright from inner to outer layer. The weired banding effect that you get when (1) Turn off depth sort transparency (2) Disable setDepthBufferFreezeTransparent (which is true by default) (3) Set PolygonAttributes.CULL_NONE is expected. Since the backface from the far side of the sphere may drawn in front of the frontface as Z buffer turn off. The color of backface drawn is darker than the color of frontface. It is perfectly legal for the graphics card to tesselate the QuadArray and drawn in whatever order it prefer when the geometry array is pass down to the native library. Hope this helps to explain the transparency issues. - Kelvin ------------- Java 3D Team Sun Microsystems Inc. =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".