1 / 99

Yingcai Xiao

Understand system design, algorithms, concepts, and pseudo code for interactive animation games. Learn about game objects, geometry, and voxelization for game space. Explore triangulation techniques for visualizing unstructured points.

silast
Download Presentation

Yingcai Xiao

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. Yingcai Xiao • Yingcai Xiao Interactive Game Design Final Overview

  2. What • System/Algorithm Design • No aesthetic design • Concepts • Systems • Algorithms • Pseudo code (logic not syntax)

  3. Coverage • All lecture notes • All assignments • Thoroughly understand what you did in the assignments.

  4. Video Game: Interactive animation Display Device Driver (GDI) Input Device Driver Game (Software)

  5. Video Game: Interactive animation Similar to all other programs: data, algorithms, input, output. Data: Game Objects Algorithms: Animation Input: Interactive Events Output: Display

  6. Game Objects (GO) GO = Geometry + Attribute

  7. Yingcai Xiao Surface and Volume Representation of Game Objects

  8. Game Objects (GO) Geometry: primitives: points, lines, triangles, polygons, spheres tetrahedrons, hexahedrons, … meshes: grids: elevation, uniform, rectlinear, structured, tin: triangular integrated network

  9. Game Objects (GO) Geometry: meshes: indexed Analytical: planes, curves, surfaces, parametrical lines, curves, …

  10. Parametric Form of a Line: • x(t) = x0 + t * (x1 – x0) • y(t) = y0 + t * (y1 – y0) • 0 <= t <= 1 • x(t) = (1-t) * x0 + t * x1 • y(t) = (1-t) * y0 + t * y1 • 0 <= t <= 1

  11. Game Objects (GO) Geometry: Stroked: stroked primitives stroked free curves and surfaces composite: avatars, prefabs, packages, …

  12. Elevation Gridorigin: 0,0,0spacing: 1,1,1dimension: 5, 5elevation:1,2,3,4,5,11, 12, 13, 14, 15,21, 22, 23, 24, 25,31, 32, 33, 34, 35,41, 42, 43, 44, 45 • Yingcai Xiao

  13. Game Objects (GO) Conversions to indexed dataset:

  14. Voxel-based Game Objects Voxelization: to partition a volume into connected voxels. Two types of voxelization: game objects game space

  15. Voxelization of Game Space and GOs To partition a game space and GOs into connected voxels. Uniform Grid Rectlinear Grid Structured Grid Unstructured Grid

  16. Uniform Grid • IJK space • x = i*dx + x0 • y = j*dy + y0 • z = k*dz + z0 • Data array (i, j, k), loop i first, then j, k last. • Simple, compact and speedy retrieval. • Not flexible

  17. Rectlinear Grid • Dimension: nx, ny, nz • Nonuniform spacing, but straight grid lines. float x[44]={0.0,1.2,2.8,3.9…….} float y[33]={1.0,……………} float z[22]={0.8,……………}

  18. Rectlinear Grid • IJK space. x = x[I]; y = y[J]; z = z[K]; • Data array (i, j, k), i changes first, then j, k last. • Simple • compact (takes O(nx +ny + nz) more space) • speedy retrieval • Little more flexible

  19. Structured Grid • Dimension: nx, ny, nz • Nonuniform spacing • IJK space (no formula) • Coordinates of each grid node need to be given. x(I,J,K), y(I,J,K), z(I,J,K)

  20. Indexed Volume / Surface • No dimensions parameters: nx, ny, nz • No IJK space • Coordinates of each node need to be given • Most flexible, can represent any structures • Easy to modify geometry, only need to change the point list. • Not compact (need space to save xyz values and cell information) • Slow retrieval

  21. IndexedDataset

  22. Summary of Volumetric Data Structures

  23. Triangulated Networks • Delaunay Triangulation

  24. Data collected in the real world • Can we use local interpolation with the closest points? • Need to find and connect the closest points. • Demo in 2D.

  25. Visualizing Unstructured Points Triangulation: Connect points to form a triangulated topological structure. (topology generation)

  26. Triangulation • Use Edge Swapping to make a Delaunay Triangulation. • Find the minimum bounding triangle. (may need to add a fake point) • Add one point at a time, do triangulation. • After each point is added, check if the joined triangles are optimal or not; if not swap the joining edge (edge swapping). Check all other triangles and make sure they are still optimal after adding the current point. • Repeat step 3 to add each point and we when all points are added and all triangles are optimal. • Clean up: remove all fake points and related triangles.

  27. Triangulation • Properties of Delaunay Triangulation: • Circumsphic property: no other points in the circumspheres. • Optimal property: The minimum interior angle of a triangle is greater than or equal to the minimum interior angle of any other triangulation • It is the dual of the Diritchlet tessellation • Voronoi cell, Centroid • A collection of connected Voronoi cells tessellete the area (partition, coverage)

  28. Triangulation Formal definition of Triangulation: N dimensional triangulation of a point set P=(P1, P2, ……,Pn) is a collection of N-dimensional simplexes (triangles) whose defining points lie in P. Optimal Triangulation: a triangulation that generates maximized minimum angles. Delaunay Trianglation: an optimal triangulation, which satisfies the circumshpere condition. Circumsphere Condition: the circumshpere of any N-dementional simplex contains no other points of P except the n+1 points defining the simplex.

  29. Shading

  30. Shading Shading: determining light reflection from objects at each pixel. Basic reflection model for a given point P: Phong Reflection Model (most commonly used) I= kaIa + kd Id (l · n) + ksIs(v · r )α I : reflected-light intensity

  31. Ambient Reflection: Direction independent ka Ia Ia : incident ambient-light intensity ka : object ambient-reflection coefficient part of the object material properties

  32. Lambertian / Diffusive Reflection: Lighting-direction dependent Id kd(ln) = Id kdcos() Id : incident diffusive-light intensity kd : object diffusive-reflection coefficient  : angle between light direction (l) and surface normal (n). Both l and n are unit vectors.

  33. Specular Reflection: Viewing-direction dependent Is ks(vr)α = Is ks cos α (Ф). Is : incident specular-light intensity ks : object specular-reflection coefficient Ф : angle between reflection direction (r) and viewing direction (v).  : specular-reflection exponent, shininess coefficient. 1/: roughness.

  34. Implementation of Reflections Ambient Reflection: Uniform distribution, Lighting-direction independent, viewer independent Implemented in OpenGL, 3D graphics cards, and GPU Lambertian / Diffusive Reflection: Lighting-direction dependent, viewer independent Implemented in OpenGL, 3D graphics cards, and GPU GPU is designed to compute diffusive reflection of every pixel within a triangle using linear interpolation of computed diffusive reflection at each vertex of the triangle.

  35. Implementation of Reflections Specular Reflection: Viewing-direction dependent (viewer dependent) Not implemented in OpenGL, 3D graphics cards Implemented through raytracing (e.g. povray) and recently through GPU Shadow: Light-direction dependent Not directly implemented in OpenGL and 3D graphics cards Can be implemented using logical buffers

  36. Implementation of Reflections Surface Reflection: Viewing-direction dependent (viewer dependent) Not implemented in OpenGL, 3D graphics cards Implemented through recursive raytracing (e.g. povray) and recently through GPU

  37. http://www.codeproject.com/KB/graphics/RayTracerNet.aspx • Figure 2. Shading effects: a) Ambient, b) Diffuse, c) Highlights, d) Shadows and e) Reflection (notice the reflection on the floor also)  Many more things consider: Shadow, Reflection, Transparency, Refraction, …

  38. Raytracing

  39. Simple Ray Tracing for Image Generation for (each scan line in image ) { for (each pixel in the scan line ) { determine ray from eye through pixel; for(each object in scene) { if(object is intersected and is the closest considered thus far) record intersection point and object id. } set pixel’s color to that at closest object intersection point (using the REGULAR I formula.) } }

  40. RECURSIVE Ray Tracing for Imaging for (each scan line in image ) { for (each pixel in the scan line ) { determine ray from eye through pixel; for(each object in scene) { if(object is intersected and is the closest considered thus far) record intersection point and object id. } set pixel’s color to that at closest object intersection point (using the RECURSIVEI formula.) } }

  41. Recursive Ray Tracing for Image Generation Set pixel’s color to that at closest object intersection point using the I formular given below. I= (1- kr - kt )Iregular+ kr Ir+ kt It Iregular: regular reflection of lights from light source. Computed by the formula above. kr : reflection coefficient. Ir: illumination from other objects (to be reflected). kt : transmission coefficient. It: illumination from other objects (to be transmitted).

  42. Simple Ray Tracing for Shadowing • for (each scan line in image ) { • for (each pixel in the scan line ) { • determine ray from the light through pixel; • for(each object in scene) • if(object is intersected) • flag the pixel as in a shadow • } • } • Usually use a separate buffer (shadow buffer) of the same size as the frame buffer to store the shadow flag. • Darkened a pixel in image generation if its shadow flag is on.

  43. Simple Ray Tracing for Collision // a ray has been defined. for(each object in scene) { if(object is intersected and is the closest considered thus far) record intersection point and object id. } The recorded object is the closest and is the one being hit.

  44. Simple Ray Tracing for Collision (Voxelized) // a ray has been defined. Follow the ray’s path for each voxel in the path { if (a GO is in) { record it’s ID break; } The recorded object is the closest and is the one being hit.

  45. Traversing Gaming Space

  46. Follow predefined paths • Follow pre-partitioned spaces • Follow line of sights • Collision detection Traversing Gaming Space

  47. Used in maze games. • 3D Maze 2: an Android app. • The predefined paths are usually bounded by predefined structures. • Simple bounding structures can be designed in game engines. • Complicated bounding structures can be designed in a Computer Aided Design software. TGS: Following predefined paths

  48. For voxelized game space, use IJK space to traverse. • x = i*dx + x0 • y = j*dy + y0 • z = k*dz + z0 • i = (x - x0) / dx • j = (y - y0) / dy • k = (z - z0) / dz TGS: Follow pre-partitioned spaces

  49. Line of sight for eyes: image generation • Line of sight for lights: shadow • Line of sight for objects: collision • Commonly use the ray tracing technique. • TGS: Follow line of sights

  50. Morphing and Procedural Animation

More Related