3D Objects Subject:T0934 / Multimedia Programming Foundation Session:12 Tahun:2009 Versi:1/0
Bina Nusantara Learning Outcomes In the end of this session, students must be able to: –Understand the basic principal of 3D objects
Outline 3D Coordinates systems 3D Models 3D Transformation 3D Rendering Java 3D API Bina Nusantara
Coordinate Systems Use x,y,z coordinates to represent a 3D object width, height, and length Left-handed coordinate system x positive to the right Right-handed coordinate system (default for Java) x positive to the left or z positive toward the viewer Bina Nusantara Y X Z Y X Z Y X Z
Object Coordinates Geometric center the point in object where x,y, and z are all zero in values, usually located inside the object. Object coordinates start from its geometric center Bina Nusantara Y X Z
World Coordinates Coordinates that shows how the objects are located in relation to the 3D world they are in Bina Nusantara X Z Y
3D Model Vertices (Vertex for singular) corner points of an object Edges lines which connect the vertices Bina Nusantara Vertex Edge Hidden line Surface/face Hidden surface
3D Polygon A closed figure created by three or more vertices connected with edges Simplest polygon triangle Complex 3D shapes can be decomposed into a collection of triangles, commonly called a mesh Bina Nusantara
Displaying 3D Model 2D Rendering 3D Rendering Transformation Modeling Create 3D model in object space Convert to world space coordinates Convert to view coordinates Convert to screen coordinates Bina Nusantara commonly called "eye space" or "camera space”. Objects are converted to view space to know what is visible on the screen. project the view coordinates into 2D coordinates that map directly to viewport (window or rectangle which limits the visibility of 3D world).
3D Transformation Position (translation) Size (scaling) Orientation (rotation) Shapes (shear) Bina Nusantara x’ y’ z’ tx ty tz xyz1xyz1 = * X Z t
Rendering Process of converting the 3D model into an on-screen 2D image Bina Nusantara Calculate the appearance of object’s different faces Convert faces into a 2D form Send the result to the video card
3D Rendering Techniques Flat shading Lambert shading Gouraud shading Phong shading Texture mapping Bump mapping Cel shading Raytracing Radiosity And so on … Bina Nusantara
Scene Graph Maintains information about all entities in the 3D world in structures called nodes Group nodes contain information about themselves and point to other nodes (descendants) Leaf nodes contain only information about themselves and have no children Bina Nusantara
Scene Graph Bina Nusantara Scene Terrain Player1 Land LightingGeometryTransform Sea LightingTransform Sky LightingTransform Player2 Man LightingGeometryTransformAudio Man LightingGeometryTransformAudio
Java 3D API Enables the creation of three-dimensional graphics applications and Internet-based 3D applets. Provides high-level constructs for creating and manipulation 3D geometry and building the structures used in rendering that geometry. Bina Nusantara
Sample Code Bina Nusantara Create 3D canvas Create The 3D World
Sample Code Bina Nusantara Create Background The 3D World
Sample Code Bina Nusantara Prepare color for the ball Prepare The Texture for the ball
Sample Code Bina Nusantara Prepare appearance for the ball by including The color and Texture Create The ball
Sample Code Bina Nusantara Prepare PointLight for lightning effect
Sample Code Bina Nusantara Adding component to The Universe
Sample Code Bina Nusantara Setting action for application
Sample Code Bina Nusantara Rotate The Ball Result
References Java 3D API Tutorial D Game Programming All in One. Finney, Kenneth C Ch 3. 3D Basic Graphics Pipeline Digital_VIZ/VideoLectures/PptLecturePdfs/GraphicsPipelineAlgorith mic_12sep08.pdfhttp:// Digital_VIZ/VideoLectures/PptLecturePdfs/GraphicsPipelineAlgorith mic_12sep08.pdf Java 3D Tutorial Combining Rotation and Translation in Java 3d Creating a 3D Universe with Java3D Bina Nusantara