1 / 18

159.235 Graphics & Graphical Programming - Where next?

159.235 Graphics & Graphical Programming - Where next?. Java 3D. Sun Microsystems solution for a high level 3d graphics system Builds on lower level technologies such as OpenGL and Direct X Java3D is a (free) package library On lab image: c:j2sdk1.4.0_02demojava3d.

nuri
Download Presentation

159.235 Graphics & Graphical Programming - Where next?

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 159.235 Graphics & Graphical Programming - Where next? Graphics

  2. Java 3D • Sun Microsystems solution for a high level 3d graphics system • Builds on lower level technologies such as OpenGL and Direct X • Java3D is a (free) package library • On lab image: c:\j2sdk1.4.0_02\demo\java3d Graphics

  3. The basic idea - Scenegraphs • Some conventions to help the renderer do a fast and efficient job • Rather than DIY 3d structures like we have developed ourselves in the example programs (based on 2d pieces) define a scenegraph and support only what needs to be adjusted - otherwise let the rendering engine do its own optimisation Graphics

  4. A Scenegraph • See the Java 3D Tutorial and Manual • In brief: • We organise the world objects in a graph structure (almost a tree) • Let the renderer optimise what to display and when • Use the Object-oriented structure and concepts Graphics

  5. Java3D Scenegraph Graphics

  6. Graphics

  7. Java 3D Hello Universe Example public static void main( String[] args ){ new MainFrame( new HelloUniverse( ), 640, 480 ); } • See the HelloUniverse example code and the Java3D Tutorial material Graphics

  8. Constructor public HelloUniverse( ) { Canvas3D c = new Canvas3D( null ); add( "Center", c ); // Create View Branch SimpleUniverse u = new SimpleUniverse( c ); // Create Content Branch BranchGroup scene = createSceneGraph( ); u.addBranchGraph( scene ); } Graphics

  9. Scene Content public BranchGroup createSceneGraph( ) { BranchGroup objRoot = new BranchGroup( ); // Create the transform group node and // enable transform write by behavior TransformGroup objTrans = new TransformGroup( ); objTrans.setCapability( TransformGroup.ALLOW_TRANSFORM_WRITE ); objRoot.addChild( objTrans ); // Create a cube shape and add to scene objTrans.addChild( new ColorCube( 0.4 ) ); . . . Graphics

  10. Rotator… // Create Behavior to rotate shape Transform3D yAxis = new Transform3D( ); Alpha rotationAlpha = new Alpha( -1, Alpha.INCREASING_ENABLE, 0, 0, 4000, 0, 0, 0, 0, 0 ); RotationInterpolator rotator = new RotationInterpolator( rotationAlpha, objTrans, yAxis, 0.0f, (float)Math.PI*2.0f ); BoundingSphere bounds = new BoundingSphere( new Point3d( 0.0, 0.0, 0.0 ), 100.0 ); rotator.setSchedulingBounds( bounds ); objTrans.addChild( rotator ); . . . Graphics

  11. “Compile” it // Optimize scene objRoot.compile( ); return objRoot; } Graphics

  12. You typically need to import… import javax.media.j3d.*; import javax.vecmath.*; import com.sun.j3d.utils.applet.MainFrame; import com.sun.j3d.utils.universe.*; import java.applet.Applet; import java.awt.BorderLayout; import java.awt.Frame; import java.awt.event.*; import com.sun.j3d.utils.geometry.*; import com.sun.j3d.utils.behaviors.*; Graphics

  13. Output like… Graphics

  14. Java 3D Summary • VirtualUniverse - Root of all Java 3D scenes • Locale - Basic Placement • SceneGraphObject - Capabilities, User data, Liveness • Node - Bounds, LocalToVworld • NodeComponent Graphics

  15. Java 3D - Where to Look • See the San Diego Tutorial and links • The demos are worth experimenting with • Morphing and GearBox are particularly insightful Graphics

  16. Java 3D is latest (?) of A series of generational developments in 3D graphics 1970s - SIGGraph CORE (on terminals) 1980s - PHIGS, 3D GKS, PEX APIs Late 80’s early 90s OpenGL Late 90’s and today Java3D and competitors Other Graphics Systems Graphics

  17. Lots of packages that use some sort of “graphics” Visual this that and the other Flash stuff Animation packages like Maya What level do you want to understand the details? Horses for Courses - what are you trying to achieve/develop? Other “Graphics Stuff” Graphics

  18. Hopefully from this paper you know enough of the graphics jargon to be able to decide/judge what system/package to use yourselves… • You may even go on to develop new algorithms for rendering special effects that no one has even thought of yet… Graphics

More Related