What do you mean "I need to update 3 times" ? Three times in the lifetime of the scene or three times per minute, per second ? (it's obvious that it doesn't make sense to update 3 times per frame).
What do you mean by "a lot of time" ? That is dependent of the way you look at the time. Sometimes 0.5 sec means short if it happens once per hour, sometimes 0.5 sec means very, very long if it happens every frame! So, please give us some figures. For example: Detaching a branch group with 1488 shapes containing 39222 vertices takes around 0.5 sec. Strange effects: If I'm detaching immediately after attaching, it takes regularly 200 ms more than if I'm waiting a while for the scene to "warm up"! Detaching a branch group with 22958 shapes containing 103987 vertices takes around 80 sec. Proposal for approach 4 ;-) Use a "master" Switch. To this one you add the original geometry. When you need to change it, add the new geometry (still invisible). When finished with adding (you don't care about the amount of time needed), just change the switch. Set the mask of the switch so that the new geometry is visible and the old one invisible. Now you can take your time to detach the old geometry. By geometry I mean a complete branch group. Cheers, Florin -----Urspr�ngliche Nachricht----- Von: Anirban Bhadore [mailto:[EMAIL PROTECTED]] Gesendet: Montag, 10. Februar 2003 07:24 An: [EMAIL PROTECTED] Betreff: [JAVA3D] Performance problem with live scenegraph Hi guys, I have performance problem with editing a live scenegraph. The problem is described below. Problem : I have 2000 shape3d nodes which I need to update three times in the scene. Approach 1 : I creat a new BranchGroup along with Shape3D and a new Geometry object and "add"( rootBranchGroup.addChild( newBG)) the new BranchGroup to the SceneGraph. After this I "detach"( OldBG.detach()) the old BranchGroup which was holding the last geometry. This addChild() and detach() calls are taking lot of time. Approach 2 : I find out the Geometry nodes and update the Geometry reference by executing MyShape3dObj.setGeometry( newGeometryObj). This also is taking almost the same time. Approach 3 : I tried to stop the renderer of the Canvas3D by calling Canvas3D.stopRenderer() and use the Immediate mode rendering to draw the geometries directly with the 3dGraphicsContext from the Canvas3D object. This also did not give me any performance benifit. Analysis : I have seen the java 3d code of addChild() and detach() methods. These uses a MasterControl lock in the VirtualUniverse class for rendering threads( Behavior Scheduler, Renderer, UserInputHandeler, Geometry change handler etc) which makes the whole process of editing a live scene graph very slow. So as it looks like manipulation of a live scene graph has a major performance problem. Am I missing something? Any suggestions? How the game writers are handling these scenarios in Java3d? Hope somebody writes back ! thanks Anir =========================================================================== 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".
