Geometry for Game 1 Game Models n Geometry
- Slides: 22
Geometry for Game 1
Game Models n Geometry – Position / vertex normals / vertex colors / texture coordinates n Topology – Primitive » Lines / triangles / surfaces / … n Property – Materials – Textures n n n Motion Hierarchy Level-of-detail 2
Geometry Data n Vertex position – (x, y, z, w) – In model space or screen spane n Vertex normal – (nx, ny, nz) n Vertex color – (r, g, b) or (diffuse, specular) n Texture coordinates on vertex – (u 1, v 1), (u 2, v 2), … n Skin weights – (bone 1, w 1, bone 2, w 2, …) 3
Topology Data n Lines – Line segments – Polyline » Open / closed n n n Indexed triangles Triangle Strips / Fans Surfaces – Non-uniform Rational B Spline (NURBS) n Subdivision 4
Indexed Triangles n Geometric data Vertex data n v 0, v 1, v 2, v 3, … n (x, y, z, nx, ny, nz, tu, tv) n or (x, y, z, cr, cg, cb, tu, tv, …) n n polygon normal Topology v 0 Face v 0 v 3 v 6 v 7 n Edge table n vertex normal v 7 v 3 v 6 Right-hand rule for index 5
Triangle Strips v 0 v 2 T 0 T 2 T 1 v 6 v 4 T 5 T 3 v 5 v 1 v 7 v 3 v 0 , v 1 , v 2 , v 3 , v 4 , v 5 , v 6 , v 7 “Get great performance to use triangle strips for rendering on current hardware 6
Property on Surface n n n Material Textures Shaders 7
Materials n Material – Ambient » Environment » Non-lighted area – Diffuse » Dynamic lighting – Emissive » Self-lighting – Specular with shineness » Hi-light » View-dependent » Not good for hardware rendering n n Local illumination For fixed function rendering pipeline 8
Textures n Textures – – – Single texture Texture coordinate animation Texture animation Multiple textures Alphamap Lightmap Base color texture Material or vertex colors 9
Shaders n Programmable Shading Language – Vertex shader – Pixel shader n Procedural way to implement some process of rendering – – – Transformation Lighting Texturing BRDF Rasterization Pixel fill-in 10
Shader Pipeline Vertex Data Topology Data Classic Transform & Lighting Vertex Shader Geometry Stage Clipping & Viewport Mapping Texturing Pixel Shader Fog Rasterizer Stage Alpha, Stencil, Depth Testing 11
Powered by Shader n n n n n Per-pixel lighting n Procedural Morphing Motion blur n Water Simulation Volume / Height fog Volume lines Depth of field Fur fighting Reflection / Refraction NPR (non-photorealistic rendering ) Shadow Linear algebra operators Perlin noise Quaternion Sparse matrix solvers Skin bone deformation Normal map Displacement map Particle shader 12
Motion Data n n Time-dependent data Transformation data – Position – Orientation n Formats – – – Pivot Position vector Quaternion Eurler angles Angular displacement 13
Level-of-detail n Discrete LOD – Switch multiple resolution models run-timely n Continuous LOD – Use progressive mesh to dynamically reduce the rendered polygons n View-dependent LOD – Basically for terrain 14
Progressive Mesh n n n Render a model in different level-of-detail at runtime User control or automatic change the percentage of rendered vertices Use mapping function between two successive meshes to control the simplification process Map for edge collapse Index 0 1 2 3 4 5 6 7 8 Map 0 1 1 2 3 0 4 5 6 Vertex list 0 1 2 3 4 5 6 7 8 Triangle list 0 2 5 0 1 2 3 5 8 0 6 0 4 15
View-dependent LOD for Terrain - ROAM n n n Real-time optimal adapting meshes (ROAM) Use height map Run-timely to re-construct the active (for rendering) geometric topology (re-mesh) to get an optimal mesh (polygon count) to improve the rendering performance Someone calls this technique as the viewdependent level-of-detail Very good for fly-simulation-like application 16
Level-of-detail Suggestion n Apply progressive mesh for multi-resolution model generation Use in-game discrete LOD for performance tuning Why ? – For modern game API / platform, dynamic vertex update is expensive (not good for performance) » Lock video memory -> aversely affect CPU/GPU performance 17
Bounding Volume n n n Bounding sphere Bounding cylinder Axis-aligned bounding box (AABB) Oriented bounding box (OBB) Discrete oriented polytope (k-DOP); k/2 pairs Bounding Sphere Bounding Cylinder AABB k-DOP OBB 18
Bounding Volume - Application n Collision Detection Visibility Culling Hit Test 19
Application Example - Bounding Sphere B 2 B 1 D c 2 c 1 Bounding sphere B 1(c 1, r 1), B 2(c 2, r 2) If the distance between two bounding spheres is larger than the sum of radius of the spheres, then these two objects have no chance to collide. d > r 1+ r 2 20
Application Example - AABB n Axis-aligned bounding box (AABB) – Simplified computation based on the axisaligned feature – Have to compute the AABBs at runtime AABB 21
Application Example - OBB n Oriented bounding box (OBB) – Intersection computation based on the transformed OBB geometric data » 3 D containment test » Line intersection with plane n OBB For games, 22
- What is the difference between model and semi modal
- Mat 360
- Iso 22301 utbildning
- Typiska novell drag
- Nationell inriktning för artificiell intelligens
- Ekologiskt fotavtryck
- Shingelfrisyren
- En lathund för arbete med kontinuitetshantering
- Särskild löneskatt för pensionskostnader
- Personlig tidbok
- Anatomi organ reproduksi
- Densitet vatten
- Datorkunskap för nybörjare
- Stig kerman
- Att skriva debattartikel
- Delegerande ledarskap
- Nyckelkompetenser för livslångt lärande
- Påbyggnader för flakfordon
- Formel för lufttryck
- Offentlig förvaltning
- Jag har nigit för nymånens skära
- Presentera för publik crossboss
- Argument för teckenspråk som minoritetsspråk