Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Geometry for Game. Geometry Geometry –Position / vertex normals / vertex colors / texture coordinates Topology Topology –Primitive »Lines / triangles.

Similar presentations


Presentation on theme: "1 Geometry for Game. Geometry Geometry –Position / vertex normals / vertex colors / texture coordinates Topology Topology –Primitive »Lines / triangles."— Presentation transcript:

1 1 Geometry for Game

2 Geometry Geometry –Position / vertex normals / vertex colors / texture coordinates Topology Topology –Primitive »Lines / triangles / surfaces / … Property Property –Materials –Textures Motion Motion Hierarchy Hierarchy Level-of-detail Level-of-detail 2 Game Models

3 3 Vertex position Vertex position –(x, y, z, w) –In model space or screen spane Vertex normal Vertex normal –(n x, n y, n z ) Vertex color Vertex color –(r, g, b) or (diffuse, specular) Texture coordinates on vertex Texture coordinates on vertex –(u 1, v 1 ), (u 2, v 2 ), … Skin weights Skin weights –(bone 1, w 1, bone 2, w 2, …) Geometry Data

4 4 Lines Lines –Line segments –Polyline »Open / closed Indexed triangles Indexed triangles Triangle Strips / Fans Triangle Strips / Fans Surfaces Surfaces –Non-uniform Rational B Spline (NURBS) Subdivision Subdivision Topology Data

5 5 Geometric data Vertex data v 0, v 1, v 2, v 3, … (x, y, z, n x, n y, n z, t u, t v ) or (x, y, z, c r, c g, c b, t u, t v, … ) Topology Face v 0 v 3 v 6 v 7 Edge table v0v0 v3v3 v6v6 v7v7 Right-hand rule for index polygon normal vertex normal Indexed Triangles

6 6 v0v0 v1v1 v2v2 v3v3 v4v4 v5v5 v6v6 v7v7 T0T0 T1T1 T2T2 T3T3 T4T4 T5T5 v 0, v 1, v 2, v 3, v 4, v 5, v 6, v 7 Triangle Strips “Get great performance to use triangle strips for rendering on current hardware

7 7 Material Material Textures Textures Shaders Shaders Property on Surface

8 8 Material Material –Ambient »Environment »Non-lighted area –Diffuse »Dynamic lighting –Emissive »Self-lighting –Specular with shineness »Hi-light »View-dependent »Not good for hardware rendering Local illumination Local illumination For fixed function rendering pipeline For fixed function rendering pipelineMaterials

9 9 Textures Textures –Single texture –Texture coordinate animation –Texture animation –Multiple textures –Alphamap Textures Material or vertex colors Base color texture Lightmap

10 10 Programmable Shading Language Programmable Shading Language –Vertex shader –Pixel shader Procedural way to implement some process of rendering Procedural way to implement some process of rendering –Transformation –Lighting –Texturing –BRDF –Rasterization –Pixel fill-in Shaders

11 11 Vertex DataTopology Data Classic Transform & Lighting Vertex Shader Clipping & Viewport Mapping TexturingPixel Shader Fog Alpha, Stencil, Depth Testing Geometry Stage Rasterizer Stage Shader Pipeline

12 Per-pixel lighting Per-pixel lighting Motion blur Motion blur Volume / Height fog Volume / Height fog Volume lines Volume lines Depth of field Depth of field Fur fighting Fur fighting Reflection / Refraction Reflection / Refraction NPR ( non-photorealistic rendering ) NPR ( non-photorealistic rendering ) Shadow Shadow Linear algebra operators Linear algebra operators Perlin noise Perlin noise Quaternion Quaternion Sparse matrix solvers Sparse matrix solvers Skin bone deformation Skin bone deformation Normal map Normal map Displacement map Displacement map Particle shader Particle shader 12 Procedural Morphing Water Simulation Powered by Shader

13 13 Time-dependent data Time-dependent data Transformation data Transformation data –Position –Orientation Formats Formats –Pivot –Position vector –Quaternion –Eurler angles –Angular displacement Motion Data

14 14 Discrete LOD Discrete LOD –Switch multiple resolution models run-timely Continuous LOD Continuous LOD –Use progressive mesh to dynamically reduce the rendered polygons View-dependent LOD View-dependent LOD –Basically for terrain Level-of-detail

15 Render a model in different level-of-detail at runtime Render a model in different level-of-detail at runtime User control or automatic change the percentage of rendered vertices User control or automatic change the percentage of rendered vertices Use mapping function between two successive meshes to control the simplification process Use mapping function between two successive meshes to control the simplification process 15 Progressive Mesh Map for edge collapse Vertex list Triangle list Index012345678 Map011230456 012345678 025012358 00 6 4

16 16 Real-time optimal adapting meshes (ROAM) Real-time optimal adapting meshes (ROAM) Use height map 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 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 view- dependent level-of-detail Someone calls this technique as the view- dependent level-of-detail Very good for fly-simulation-like application Very good for fly-simulation-like application View-dependent LOD for Terrain - ROAM

17 17 Apply progressive mesh for multi-resolution model generation Apply progressive mesh for multi-resolution model generation Use in-game discrete LOD for performance tuning Use in-game discrete LOD for performance tuning Why ? Why ? –For modern game API / platform, dynamic vertex update is expensive (not good for performance) »Lock video memory -> aversely affect CPU/GPU performance Level-of-detail Suggestion

18 18 Bounding sphere Bounding cylinder Axis-aligned bounding box (AABB) Oriented bounding box (OBB) Discrete oriented polytope (k-DOP); k/2 pairs Bounding Sphere AABB OBB k-DOP Bounding Volume Bounding Cylinder

19 19 Collision Detection Collision Detection Visibility Culling Visibility Culling Hit Test Hit Test Bounding Volume - Application

20 20 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 D B1B1 B2B2 c1c1 c2c2 Application Example - Bounding Sphere

21 21 Axis-aligned bounding box (AABB) Axis-aligned bounding box (AABB) –Simplified computation based on the axis- aligned feature –Have to compute the AABBs at runtime AABB Application Example - AABB

22 22 Oriented bounding box (OBB) Oriented bounding box (OBB) –Intersection computation based on the transformed OBB geometric data »3D containment test »Line intersection with plane For games, For games, OBB Application Example - OBB


Download ppt "1 Geometry for Game. Geometry Geometry –Position / vertex normals / vertex colors / texture coordinates Topology Topology –Primitive »Lines / triangles."

Similar presentations


Ads by Google