1 / 18

Game Programming

Game Programming. 3D Scenegraph. Informatics University of Brawijaya. Eriq Muhammad Adams J. eriq.adams@ub.ac.id | http://eriq.lecture.ub.ac.id. Agenda . Hello JMonkeyEngine 3.0 3D Math Scenegraph. Hello JMonkeyEngine 3.0 (cont.).

catrin
Download Presentation

Game Programming

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. Game Programming 3D Scenegraph Informatics University of Brawijaya Eriq Muhammad Adams J. eriq.adams@ub.ac.id | http://eriq.lecture.ub.ac.id

  2. Agenda Hello JMonkeyEngine 3.0 3D Math Scenegraph

  3. Hello JMonkeyEngine 3.0 (cont.) You can extends com.jme3.app.SimpleApplication to build JMonkey apps. SimpleApplication provide us default camera input. simpleInitApp() is used for game initialization. to start app you can call start() from your main(). rootNode is top node in JME scenegraph. Lets look the code at jme3test.helloworld.HelloJME http://jmonkeyengine.org/wiki/doku.php/jme3:beginner:hello_simpleapplication

  4. Hello JMonkeyEngine 3.0 (cont.)

  5. Hello JMonkeyEngine 3.0 (cont.) Extends SimpleApplication Start application Initialization (resources creation )

  6. 3D Math • Coordinate defined as com.jme3.math.Vector3f (x,y,z) • Origin coordinate is (0,0,0) • Unit measurement is wu (world unit), typically 1 wu is 1 meter. JME uses right-handed coordinated system (as OpenGL does).

  7. 3D Math (cont.) Transformation : operation that converts points from one coordinate system to another includes rotation, scaling, translation. Local transforms represent the positioning of objects relative to a parent coordinate system. Global transforms represent the positioning of objects in a global coordinate system. JME 3.0 provide us low-level transformation functionality.

  8. 3D Math (cont.) Visibility Determination concerns itself with minimizing the amount of data that is sent to the graphics card for rendering. Not all data being sent to graphics card but data which we can see are being sent. Data not sent to is said to be culled. Fustrum Culling is the procedure for visibility determination. The BoundingVolume of an object is tested against the frustum planes to determine if it is contained in the frustum. If at any point the object's bounding is outside of the plane, it is tossed out and no longer processed for rendering.

  9. 3D Math (cont.) View Fustrum Culling : the process of removing objects that lie completely outside the viewing frustum from the rendering process (wikipedia)

  10. 3D Math (cont.) Fundamental Types in JME 3.0 : ColorRGBA, Matrix (Matrix 3f, Matrix4f), Vector (Vector2f, Vector3f). ColorRGBA defines a color value (red, green, blue, alpha). Matrix typically used as linear transformations (scale, rotate, translate) to map vectors to vectors. Matrix3f is a 3×3 matrix and is the most commonly used (able to handle scaling and rotating), while Matrix4f is a 4×4 matrix that can also handle translation.

  11. 3D Math (cont.) Source : New Riders, Beginning Math and Physics for Game Programmers

  12. 3D Math (cont.) Vectors are used to represent a multitude of things in jME, points in space, vertices in a triangle mesh, normals, etc. These classes (Vector3f in particular) are probably the most used class in jME. Quaternions define a subset of a hyper complex number system. Quaternions are defined by (i2 = j2 = k2 = i j k = -1). jME makes use of Quaternions because they allow for compact representations of rotations, or correspondingly, orientations, in 3D space. With only four float values, we can represent an object's orientation, where a rotation matrix would require nine. They also require fewer arithmetic operations for concatenation.

  13. 3D Math (cont.) For more math tutorials in JME please learn JME math for dummies presentation at http://jmonkeyengine.org/wiki/doku.php/jme3:math_for_dummies

  14. Scenegraph Represents your 3D world. Object in JME scenegraph are called spatial.

  15. Scenegraph (cont.)

  16. Scenegraph (cont.)

  17. Scenegraph (cont.) Create Blue Cube Create Red Cube Create Node “Pivot” Attach blue & red cube to pivot node Rotate Pivot Node

  18. Scenegraph (cont.) Root Node Pivot Node Red Cube Blue Cube

More Related