se3250 intro to 3d computer graphics
play

SE3250 Intro to 3D Computer Graphics Jay Urbain Credits: OpenGL, - PowerPoint PPT Presentation

SE3250 Intro to 3D Computer Graphics Jay Urbain Credits: OpenGL, Jason Leigh University of Illinois at Chicago Geometry - Polygon, Mesh, Vertex Most visible objects in a 3D scene are made up of polygon meshes A mesh is a grid-like


  1. SE3250 Intro to 3D Computer Graphics Jay Urbain Credits: OpenGL, Jason Leigh University of Illinois at Chicago

  2. Geometry - Polygon, Mesh, Vertex • Most visible objects in a 3D scene are made up of polygon meshes • A mesh is a grid-like structure that represents a complex shape. Mathematically simple to render in real time, and detailed enough to be • recognizable. • Every shape is reduced to a number of connected polygons , usually triangles; including round surfaces. triangles; including round surfaces. • Polygons' corner points are called vertices . • Every vertex is positioned at a coordinate , all vertices together describe the outline of the shape. • Create 3D meshes in tools called mesh editors, e.g in Blender, Maya.

  3. Polygons, Meshes & Scan Conversion V1 Raster Scan line V3 V2

  4. Coordinate Systems Left-handed Right-handed Coordinate System Coordinate System (typical computer graphics (conventional Cartesian Reference system) reference system) Y Y Y Z X X Z

  5. Geometric Transformations Translate Scale • Transformation occurs about the origin of the coordinate system’s axis Rotate

  6. Order of Transformations Make a Difference Box centered at Rotate about Z 45; Translate along X 1; origin Translate along X 1 Rotate about Z 45

  7. Hierarchy of Coordinate Systems • Also called: Local coordinate system – Scene graphs – Parent and Child Entities – Sometimes called Skeletons because it is usually used to represent people (arms, legs, represent people (arms, legs, body).

  8. The Camera Parallel (orthographic) Projection Perspective Projection

  9. The Camera Near Clipping Far Clipping Plane Plane Projection Plane View Volume

  10. Materials: Color, Lighting/Shading • “ Color " is part of an object's light reflection. • Our brain uses shading and reflecting properties to infer an object's shape and material. Differentiate chalk & milk, skin & paper, water & plastic. • • Ambient color – The uniform base color of the mesh – what it looks like when not The uniform base color of the mesh – what it looks like when not influenced by any light source. – Usually similar to the Diffuse color. – Min. color you need for an object to be visible. Diffuse color • – Base color of the mesh plus shattered light and shadows that are caused by a light source. – Usually similar to the Ambient color.

  11. Ambient Lighting • No light source – material color

  12. Light Sources - Emissive color • Emissive color – The color of light emitted by a light source or glowing material. – Only glowing materials such as lights have an emissive color, normal objects don't have this property. – Often white (sun light).

  13. Light Sources - Reflections • Reflections: Shininess – Degree of shininess of a surface. – Shiny objects have small, clearly outlined specular highlights . (E.g. glass, water, silver) – Normal objects have wide, blurry specular highlights. (E.g. metal, plastic, stone, polished highlights. (E.g. metal, plastic, stone, polished materials). – Uneven objects are not shiny and have no specular highlights. (E.g. cloth, paper, wood, snow) .

  14. Light Sources - Reflections • Reflections: Specular Color – If the material is shiny, then the Specular Color is the color of the reflected highlights. – Usually the same as the emissive color of the light source (e.g. white). – You can use colors to achieve special specular effects, such as metallic or iridescent reflections. or iridescent reflections. – Non-shiny objects have a black specular color.

  15. Elements of OpenGL Lighting • http://www.youtube.com/watch?v=g5pJd4L3aBM • http://www.youtube.com/watch?v=sd0BOnN6aNY&feature=r elated

  16. Materials: Textures • Simplest case: object has one texture, the Color Map, loaded from one image file. • The more information you provide to the Color Map, the higher the degree of detail and realism. Whether you want photo-realistic rendering or "toon" rendering (Cel • Shading), everything depends on the quality of your materials and Shading), everything depends on the quality of your materials and textures. • Modern 3D graphics use several layers of information to describe one material, each mapped layer is a texture.

  17. Color Map / Diffuse Map • A plain image file or a procedural texture that describes an object's visible surface. • The image can have alpha channels for transparency. • A Color Map is the minimum texture. You can map more textures as optional improvements. textures as optional improvements. • Color Maps are unshaded. The same is called Diffuse Map in a Phong-illuminated material, because this texture defines the basic colors of light that are diffused by this object.

  18. Diffuse Reflection (Lambertian Lighting Model) The greater the angle between the normal and the vector from the point to the light source, the less light is reflected. Most light is reflected when the angle is 0 degrees, none is reflected at 90 degrees.

  19. Specular Reflection (Phong Lighting Model) • Maximum specular reflectance occurs when the viewpoint is along the path of the perfectly reflected ray (when alpha is zero). • Specular reflectance falls off quickly as alpha increases. quickly as alpha increases. • Falloff approximated by cos n (alpha) . • n varies from 1 to several hundred, depending on the material being modeled. • n=1 provides broad, gentle falloff • Higher values simulate sharp, focused highlight. • For perfect reflector, n would be infinite.

  20. Fall off in Phong Shading Large n Small n

  21. Approximating Curved Surfaces with Flat Polygons Flat Shading – each polygon face has a normal that is used to perform lighting calculations.

  22. Gouraud Shading • Compute vertex normals by averaging face normals. • Compute intensity at each vertex. Interpolate the intensity along • the edges of the polygon. I1 Raster I1,2,3,4 I1,2 I1,3 Scan line I3 I2

  23. Phong Shading N1 • Interpolate the Normals between the end points Raster of the scan line rather N1,2 N1,2,3,4 N1,3 Scan line than just the intensity. • Used with Phong N3 lighting model to lighting model to N2 N2 produce specular highlights. N1,3 N1,2 http://www.youtube.com/watch?v=Seo5eo3GUQo&feature=related

  24. Texture Mapping • Apply picture to a polygon surface to add realism without explicitly creating geometry. v u

  25. Texture Maps Used in Tank Game

  26. Sprite • Typically a 2D image or animation that is integrated into a larger scene. • Initially used to describe graphical objects handled separate from the memory bitmap of a video display. • Term has since been applied more loosely to refer to various • Term has since been applied more loosely to refer to various manner of graphical overlays.

  27. Billboarding Sprite now refers to a partially transparent two dimensional • animation that is mapped onto a special plane in a 3D scene. Unlike a texture map, the sprite plane is always perpendicular to • the axis emanating from the camera. The image can be scaled to simulate perspective, rotated two • dimensionally, overlapped with other objects, and can be occluded. • It can only be viewed from a single angle. • This rendering method is also referred to as billboarding . • http://www.youtube.com/watch?v=0PtEW3It65s

  28. Billboarding Billboards Real

  29. Backface Culling & Flipping Surface Normals

  30. Normal Mapping • In modern games, normal maps are computed for high polygon scenes and then mapped onto low polygon models giving them incredible levels of detail

  31. Bump Mapping • Predecessor to Normal Mapping where a greyscale texture is used as a height field to modify the shading normal on the surface of a polygon (on a per pixel basis) • Creates very similar effect as Normal Mapping Perturbed normals Height field Polygon surface

  32. Normal Mapping • Modify normals on a per-pixel basis using a Normal Map • The map is an R,G,B map where the 3 components represent the direction of the normal vector relative to the tangent of the polygon’s surface Regular texture map Texture map + normal map

  33. Weakness of Normal/Bump Mapping • If you look at the polygon on its Bump side, it will still look flat. • Answer: Use parallax mapping to modify texture. • Answer: Use Displacement Mapping to perturb the actual Mapping to perturb the actual geometry of the mesh Displacement • Height field is used to displace the geometry of the mesh along its normal

  34. Double Buffering, Drawing Order, Z Buffering Back Buffer Image is drawn to the back Front buffer while the front buffer is displayed to the viewer. Buffer Buffer Swapping is usually done Swapping is usually done during vertical blank of the monitor (50Hz). Most PCs tend to turn this synch off resulting in flickering of graphics.

  35. Depth Sorting of Polygons • Polygons have to be sorted 8 back-to-front to draw them in 2 3 4 the right order. • Z Buffer ~ 16-32 bits/pixel. • Buffer that stores depth information on a per pixel basis. Used to determine which pixel Used to determine which pixel • • is in front of the other. • Small Z values are in front. • Avoids having to sort polygons in Z when rasterizing.

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend