3 D Game Programming Geometric Transformations MingTe Chi
- Slides: 28
3 D Game Programming Geometric Transformations Ming-Te Chi Department of Computer Science, National Chengchi University
Outline Geometric Transformations Basic transformation – The coordinates – Hierarchy transformation
Transformation Terminology Viewing Modelview Projection Viewport
Transformations Translation Rotation Scaling
The Modelview Duality +y +y +x +z View moving Model moving
Projection World space Orthographic Perspective
Coordinate System Unity is a Left-Handed Coordinate System
Transform
Matrix/vector
Transform Translate(tx, ty, tz); Rotate(…); Scale(sx, sy, sz); gl. Load. Identity();
Rotate public void Rotate(Vector 3 euler. Angles, Space relativ e. To = Space. Self); public void Rotate(Vector 3 axis, float angle, Space relative. To = Space. Self); public void Rotate. Around(Vector 3 point, Vector 3 axis, float angle);
Rotation/Translation from world to object +y +y +x +x Translate( ) Rotate() Rect() +y +y +y Rotate() +x +x +x Translate( ) Rect()
Transformation Pipeline eye object v e r t e x Modelview Matrix Projection Matrix Modelview Projection Modelview l l l 13 Per Vertex Poly. CPU Raster DL Frag FB Texture Pixel normalized device clip Perspective Division window Viewport Transform other calculations here – – – material ècolor shade model (flat) polygon rendering mode polygon culling clipping
The Life of a vertex Image by Philp Rideout
Image by Philp Rideout
Transformation Example 1 24
Transformation Example 2 25
Transformation Example 2 26
MESH FORMAT
Representing a Mesh Consider a mesh e 2 v 6 v 5 e 3 e e 8 v 9 v 4 8 e 11 e 10 v e 4 e 7 7 v 1 v 2 e 12 v 3 e 6 e 5 There are 8 nodes and 12 edges – 5 interior polygons – 6 interior (shared) edges Each vertex has a location vi = (xi yi zi) 30
3 D model format SIMPLE Triangle vertex 1_X vertex 1_Y vertex 1_Z normal 1_X normal 1_Y normal 1_Z vertex 2_X vertex 2_Y vertex 2_Z normal 2_X normal 2_Y normal 2_Z vertex 3_X vertex 3_Y vertex 3_Z normal 3_X normal 3_Y normal 3_Z COLOR Triangle frontcolor_R frontcolor_G frontcolor_B backcolor_R backcolor_G backcolor_B vertex 1_X vertex 1_Y vertex 1_Z normal 1_X normal 1_Y normal 1_Z vertex 2_X vertex 2_Y vertex 2_Z normal 2_X normal 2_Y normal 2_Z vertex 3_X vertex 3_Y vertex 3_Z normal 3_X normal 3_Y normal 3_Z
Simple Representation Define each polygon by the geometric locations of its vertices Leads to Open. GL code such as gl. Begin(GL_POLYGON); gl. Vertex 3 f(x 1, x 1); gl. Vertex 3 f(x 6, x 6); gl. Vertex 3 f(x 7, x 7); gl. End(); Inefficient and unstructured – Consider moving a vertex to a new location – Must search for all occurrences 32
Inward and Outward Facing Polygons The order {v 1, v 6, v 7} and {v 6, v 7, v 1} are equivalent in that the same polygon will be rendered by Open. GL but the order {v 1, v 7, v 6} is different The first two describe outwardly facing polygons Use the right-hand rule = counter-clockwise encirclement of outward-pointing normal Open. GL can treat inward and outward facing polygons differently 33
Wavefront obj format #example obj file v -1. 63326156 -3. 04798102 -8. 81131839 …. vn 0. 00379090 0. 40057179 0. 01256634 … vt 0. 22390614 0. 97395277 (texture) … f 4/2/4 3/1/3 2/2/2 (index to v/t/n)
Reference Obj format http: //www. martinreddy. net/gfx/3 d/OBJ. spec Ply format STL format - http: //en. wikipedia. org/wiki/STL_(file_format)
Scene Graph COLLADA FBX Alembic
Rotation/Translation from object to world +y +y +y Rotate() +x +x +x Translate( ) Rect() +y +y +x +x Translate( ) Rotate() Rect()
- đổi địa chỉ logic sang địa chỉ vật lý
- Chi chi does nnn
- Chi chi tg tf
- Chi domanda lavoro
- The basic geometric transformations are
- Pixel array
- Geometry bootcamp answers
- Mathisfun tetris
- Transformations review game
- Geometric semantic genetic programming
- Perbedaan linear programming dan integer programming
- Greedy vs dynamic programming
- System programming vs application programming
- Linear vs integer programming
- Perbedaan linear programming dan integer programming
- Game programming patterns robert nystrom download
- Game programming algorithms and techniques
- Texture in game programming
- Gameprogrammingpatterns
- The pirate game sheet
- The farming game board game
- A formal approach to game design and game research
- Game lab game theory
- Liar game game theory
- Liar game game theory
- Sin graph points
- Transformations of quadratic functions
- Transformations of quadratic graphs
- Transformations of linear and absolute value functions