Ali, Also RenderingAttributes.setVisible, which should be pretty quick (especially if you share Appearances). If you benchmark the various approaches it would be useful if you posted the results!
Sincerely, Daniel Selman Author - "Java 3D Programming" http://www.manning.com/selman -----Original Message----- From: Discussion list for Java 3D API [mailto:[EMAIL PROTECTED]]On Behalf Of Josh Richmond Sent: Monday, August 12, 2002 7:29 AM To: [EMAIL PROTECTED] Subject: Re: Transparency or detaching - make objects disappear Hi Ai, I know I'm not answering your question about transparency, but I think using a Switch node may be a preferable solution. Josh >>> [EMAIL PROTECTED] 08/12/02 07:06AM >>> Dear all; My scene contains about 1000 objects. I want to make about 750 of them disappear and appear in my scene by clicking some buttons. Which one is a better approach in terms of cheaper rendering? 1) Making the appearance of the objects totally transparent and than opaque? 2) Detaching the objects from the scene and than attaching them again? I chose the first approach: Before I use transparency attributes (Code_1) the objects are looking fine (see "without_tranparency.jpg"). Than I converted my code so that the objects have transparency attributes (with 0.0 or 1.0 - opaque and totaly transparent). When I apply transparency value 0.0 I expect my objects to be totally opaque. However, the objects have some transparency even if the value is 0.0 (see "with_tranparency.jpg"). Has anybody got idea why this happens? Regards Ali // APPEARANCE CODE_1_WITHOUT TRANSPARENCY ATTRIBUTES Appearance app = new Appearance(); ColoringAttributes ca = new ColoringAttributes(); ca.setColor(0.921875f, 0.92578125f, 0.81640625f); app.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_WRITE); app.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_READ); app.setColoringAttributes(ca); shape.setAppearance(app); //************************************************************************** **************** // APPEARANCE CODE_2_WITH TRANSPARENCY ATTRIBUTES Appearance app = new Appearance(); ColoringAttributes ca = new ColoringAttributes(); ca.setColor(0.921875f, 0.92578125f, 0.81640625f); app.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_WRITE); app.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_READ); app.setColoringAttributes(ca); TransparencyAttributes ta = new TransparencyAttributes( ); ta.setTransparency(0.0f); ta.setTransparencyMode(TransparencyAttributes.BLENDED); app.setCapability(TransparencyAttributes.ALLOW_VALUE_WRITE); app.setCapability(TransparencyAttributes.ALLOW_VALUE_READ); app.setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_WRITE); app.setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_READ); app.setTransparencyAttributes(ta); shape.setAppearance(app); ========================= 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". =========================================================================== 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".
