Lecture21 Other Java Gamming technologies – Java3D (This lecture will not be assessed)

Slides:



Advertisements
Similar presentations
Graphics Pipeline.
Advertisements

Java3D Presented By Chris Gundlach
Scenegraph. Scenegraph Nodes - all implement a run function Leaf/Geo Nodes - typedefs of sgNode superclass –Poly Mesh A geo node that stores a list of.
Tomas Mőller © 2000 Speeding up your game The scene graph Culling techniques Level-of-detail rendering (LODs) Collision detection Resources and pointers.
Hierarchical Modeling I Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 1 Chapter 11 Animation F To understand the.
Virtual reality interfaces in connection with building process simulations. Prof. Nash Dawood Centre for Construction Innovation Research University of.
Lecture22 Java3D - Interaction - This lecture will not be assessed.
Further Programming for 3D applications CE Introduction to Further Programming for 3D application Bob Hobbs Faculty of Computing, Engineering and.
Java 3D Pablo Figueroa University of Alberta April 2000.
Graphics Systems I-Chen Lin’s CG slides, Doug James’s CG slides Angel, Interactive Computer Graphics, Chap 1 Introduction to Graphics Pipeline.
Sep 30, I3I3DG&VR CE00539-m Interactive 3D Graphics and Virtual Reality Bob Hobbs Faculty of Computing, Engineering and Technology Staffordshire.
Graphical Objects and Scene Graphs CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Ch 1 Intro to Graphics page 1CS 367 First Day Agenda Best course you have ever had (survey) Info Cards Name, , Nickname C / C++ experience, EOS experience.
Nathaniel Salazar Massachusetts Institute of Technology Mentor: Thomas Meyer Internship Site: MHPCC.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology 3D Engines and Scene Graphs Spring 2012.
Hierarchical Transformations Hierarchical Models Scene Graphs
Overview of Computer Graphics Chapter 1. Bird’s Eye View  Overview of Computer Graphics –Basic concept of computer graphics, system, programming platforms,
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 1 Chapter 1 Overview of Computer Graphics.
Basic 3D Graphics Chapter 5. Bird’s Eye View  Basic 3D Graphics –Basic concepts of 3D graphics, rendering pipeline, Java 3D programming, scene graph,
3D Concepts Coordinate Systems Coordinates specify points in space 3D coords commonly use X, Y, & Z A vertex is a 'corner' of an object Different coordinate.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 19 Other Graphics Considerations Review.
Course Overview, Introduction to CG Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, September 5, 2003.
1 Introduction to Java 3D Java 3D Overview v API for 3D applications v Portable.
1 Review of COMPSCI 221  Chapters 1-11 in text  User Interfaces will be addressed as a take- home question.
Java 3D Introduction Stefan Rufer Assistant Computer Science Departement
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
1 Additional 3D Topics  Splitting polygons  Off screen rendering for capture of rendered images.  Sound in Java 3D scene graphs  Advanced textures.
Java ME & Blackberry APIs for Game Dev Week III. Overview Java 2D API Java 3D API SVG Blackberry APIs
, Computer Engineering Lab II (3rd Year)
Objectives Review some advanced topics, including Review some advanced topics, including Chapter 8: Implementation Chapter 8: Implementation Chapter 9:
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
CS324e - Elements of Graphics and Visualization Checkerboard World.
Java3D Overview Scene graph Java 3D classes Describing objects Groups, transforms Behaviors, interpolators Lighting.
3D Visualisation of Simulation Data. Informal Seminar 08/03/2004. By Chris Sweet.
1 Animation & Java3D ©Anthony Steed Overview n Introduction to Animation Kinematics Dynamics Boids n Java3D Scene graph Animation Vehicles.
Graphical Objects and Scene Graphs 1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009.
3D Objects Subject:T0934 / Multimedia Programming Foundation Session:12 Tahun:2009 Versi:1/0.
A Simple Talk on Java 3D Presented by C.H. Chen on Jul. 6, 2004.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
1 Chapter 1 Overview of Computer Graphics  To understand the basic objectives and scope of computer graphics  To identify computer graphics applications.
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 Going-through.
CSC 461: Lecture 3 1 CSC461 Lecture 3: Models and Architectures  Objectives –Learn the basic design of a graphics system –Introduce pipeline architecture.
Computer Graphics I, Fall 2008 Introduction to Computer Graphics.
1Computer Graphics Lecture 4 - Models and Architectures John Shearer Culture Lab – space 2
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
111/22/ :40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.
CS324e - Elements of Graphics and Visualization Java 3D Intro.
Interface Opportunities for 3D Data and Media User Interface Software TechNote Panel Virginia Tech CS Fall 2002 Nicholas F. Polys Umur Yilmaz Will Lee.
INTRODUCTION GORT is a virtual 3D modeling environment for computer programmers. Its main area of focus is to aid in the education of programmers learning.
CSE 381 – Advanced Game Programming GLSL. Rendering Revisited.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Java 3D Web Apps and Services. Presentation Overview l Java3D Overview l Software l Java3D API l Scene Graph Programming Model l Java3D Terminology l.
1 9 Lighting a Scene v There are four types of lighting: –ambient light –directional light –point light –spotlight v Any number of these can be added to.
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 1 Chapter 11 Animation.
1 Angel: Interactive Computer Graphics5E © Addison- Wesley 2009 Image Formation Fundamental imaging notions Fundamental imaging notions Physical basis.
Graphical Objects and Scene Graphs Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
1 Perception and VR MONT 104S, Fall 2008 Lecture 20 Computer Graphics and VR.
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 1 Chapter 5 Basic 3D Graphics.
Improving the appearance of 3D OpenGL scenes
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
Chapter 1 Graphics Systems and Models Models and Architectures.
Computer Graphics I, Fall 2008 Hierarchical Modeling I.
1 6.Interpolation v Animation is implemented using time- based interpolation (or morphing) –time is specified using the class –time is specified using.
MPEG-4 Binary Information for Scenes (BIFS)
The Graphics Rendering Pipeline
3D-Online Product Configuration by Java3D
Lecture 13 Clipping & Scan Conversion
Computer Graphics Lecture 15.
Presentation transcript:

Lecture21 Other Java Gamming technologies – Java3D (This lecture will not be assessed)

Java3D The Java 3D API provides a collection of high- level constructs for creating, rendering, and manipulating a 3D scene graph composed of geometry, materials, lights, sounds, and more. There are two Java 3D variants: one implemented on top of OpenGL, the other above DirectX Graphics. The low-level API handles the native rendering at the vertex and pixel levels, while the 3D scene, application logic, and scene interactions are carried out by Java code. This dual approach encourages application portability, hardware independence, and high-speed rendering. Intended application areas include visualization, CAD/CAM, virtual reality, simulation, and gaming.

The Scene Graph Java 3D’s scene graph is a directed acyclic graph (a DAG), so there's a parent-child relationship between most of its nodes, and the graph doesn't contain loops. It is possible for nodes to be shared in a graph, for example to duplicate geometry details.

Scene Graph - Example A simplified scene graph for an office:

Scene Graph Symbols

Nodes A shape node employs Shape3D (or its subclasses) as a container for Geometry and Appearance node components. The main geometry class is GeometryArray, used for drawing points, lines, and polygons. There are many Appearance subclasses, including ones for colour, texture, and transparency. Environment nodes handle environmental concerns, such as lighting, sound, and behaviours that change the virtual world. Group nodes are containers for other groups or leaf nodes. Leaf nodes are usually shape or environmental nodes. The Group class supports node positioning and orientation for its children, and is subclassed in various ways. For instance, BranchGroup allows children to be added or removed from the graph at run time, while TransformGroup permits the position and orientation of its children to be changed.

Scene Graph – Virtual Universe Each scene graph has a single VirtualUniverse. The VirtualUniverse object has a list of Locale objects. A Locale object provides a reference point in the virtual universe. Think of a Locale object as being a landmark used to determine the location of visual objects in the virtual universe. While a VirtualUniverse object may reference many Locale objects, most Java 3D programs have only one Locale object.

Virtual Universe The visual objects in front of the image plate are rendered to the image plate. Rendering can be thought of as projecting the visual objects to the image plate.

Virtual Universe

Scene Sub Graphs There are two different categories of scene sub graph: the view branch graph and the content branch graph. The content branch graph specifies the contents of the virtual universe - geometry, appearance, behaviour, location, sound, and lights. The view branch graph specifies the viewing parameters such as the viewing location and direction. Together, the two branches specify much of the work the renderer has to do.

Basic Recipe for java3D program 1. Create a Canvas3D object 2. Create a VirtualUniverse object 3. Create a Locale object, attaching it to the VirtualUniverse object 4. Construct a view branch graph 5. Construct content branch graph(s) 6. Compile branch graph(s) 7. Insert content branch graphs into the Locale

Using a SimpleUniverse Object Steps 2, 3, and 4 of the previous basic recipe are replaced by step 2 of the following simple recipe. 1. Create a Canvas3D Object 2. Create a SimpleUniverse object which references the earlier Canvas3D object a. Customize the SimpleUniverse object 3. Construct content branch 4. Compile content branch graph 5. Insert content branch graph into the Locale of the SimpleUniverse

SimpleUniverse The SimpleUniverse object creates a complete view branch graph for a virtual universe. The view branch graph includes an image plate. An image plate is the conceptual rectangle where the content is projected to form the rendered image. The Canvas3D object, which provides an image in a window on your computer display, can be thought of as the image plate. Specifically, this class creates Locale, VirtualUniverse, ViewingPlatform, and Viewer objects (all with their default values). The objects have the appropriate relationships to form the view branch graph. SimpleUniverse(Canvas3D canvas3D) Construct as simple universe with a reference to the named Canvas3D object.

Example The rotating colour cube example from Java3D tutorial available from sun website The rotating colour cube example from Java3D tutorial available from sun website

The scene graph for the rotating colour cube

Rotating Colour Cube public class HelloJava3D extends Applet { public HelloJava3D() { setLayout(new BorderLayout()); Canvas3D canvas3D = new Canvas3D(null); add("Center", canvas3D); BranchGroup scene = createSceneGraph(); scene.compile(); // SimpleUniverse is a Convenience Utility class SimpleUniverse simpleU = new SimpleUniverse(canvas3D); // This moves the ViewPlatform back a bit so the // objects in the scene can be viewed. simpleU.getViewingPlatform().setNominalViewingTransform(); simpleU.addBranchGraph(scene); } // end of HelloJava3D (constructor) … }

Rotating Colour Cube public BranchGroup createSceneGraph() { BranchGroup objRoot = new BranchGroup(); TransformGroup objSpin = new TransformGroup(); objSpin.setCapability( TransformGroup.ALLOW_TRANSFORM_WRITE ); objRoot.addChild(objSpin); objSpin.addChild(new ColorCube(0.4)); // Behaviour Alpha rotationAlpha = new Alpha(-1, 4000); RotationInterpolator rotator = new RotationInterpolator(rotationAlpha, objSpin); // a bounding sphere specifies a region a behavior is active BoundingSphere bounds = new BoundingSphere(); rotator.setSchedulingBounds(bounds); objSpin.addChild(rotator); return objRoot; } // end of createSceneGraph method

Capabilities There are cases when a program still needs the capability to change values in a scene graph object after it becomes live. For example, changing the value of a TransformGroup object creates animations. For this to happen, the transform must be able to change after it is live. The list of parameters that can be accessed, and in which way, is called the capabilities of the object. ALLOW_TRANSFORM_READ - Specifies the TransformGroup node allows access to the transform information of its object. ALLOW_TRANSFORM_WRITE - Specifies the TransformGroup node allows writing the transform information of its object.

Specifying Animation Behavior A behavior action can be a change in location (PositionInterpolator), orientation (RotationInterpolator), size (ScaleInterpolator), color (ColorInterpolator), or transparency (TransparencyInterpolator) of a visual object. RotationInterpolator object - This class defines a behavior that modifies the rotational component of its target TransformGroup by linearly interpolating between a pair of specified angles (using the value generated by the specified Alpha object). The interpolated angle is used to generate a rotation transform.

Specifying Animation Behavior Alpha class objects are used to create a time varying function. It converts time into an alpha value (a value in the range 0 to 1). Alpha(int loopCount, long increasingAlphaDuration) loopCount - number of times to run this alpha object; a value of -1 specifies that the alpha loops indefinitely. increasingAlphaDuration - time in milliseconds during which alpha goes from zero to one

Behaviour - Scheduling Region Scheduling region is a spatial boundary for a behavior to take place. A behavior is not active unless the ViewPlatform’s activation volume intersects a Behavior object’s scheduling region. In other words, if there is no one in the forest to see the tree falling, it does not fall.