3D Graphics for Game Programming Chapter IV Fragment Processing and Output Merging.

Slides:



Advertisements
Similar presentations
15.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 15 – Visible Surfaces and Shadows.
Advertisements

Real-Time Rendering 靜宜大學資工研究所 蔡奇偉副教授 2010©.
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Graphics Pipeline.
Texture Mapping. Texturing  process that modifies the appearance of each point on a surface using an image or function  any aspect of appearance can.
Week 7 - Monday.  What did we talk about last time?  Specular shading  Aliasing and antialiasing.
Hidden Surface Removal CSE 581. Visibility Assumption: All polygons are opaque What polygons are visible with respect to your view frustum?  Outside:
CHAPTER 12 Height Maps, Hidden Surface Removal, Clipping and Level of Detail Algorithms © 2008 Cengage Learning EMEA.
1 Computer Graphics Chapter 9 Rendering. [9]-2RM Rendering Three dimensional object rendering is the set of collective processes which make the object.
Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova.
HCI 530 : Seminar (HCI) Damian Schofield.
CS 4731: Computer Graphics Lecture 18: Hidden Surface Removal Emmanuel Agu.
1Notes. 2Atop  The simplest (useful) and most common form of compositing: put one image “atop” another  Image 1 (RGB) on top of image 2 (RGB)  For.
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Chapter 12: Making the Applications Interesting.
Game Engine Design ITCS 4010/5010 Spring 2006 Kalpathi Subramanian Department of Computer Science UNC Charlotte.
Part I: Basics of Computer Graphics Rendering Polygonal Objects (Read Chapter 1 of Advanced Animation and Rendering Techniques) Chapter
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Other Rendering Techniques Types of rendering – Wireframe techniques – Scan-line conversion – Reyes.
1. 2  A computer is a device capable of storing data  in a format suited to the computer,  which is then processed by mathematical manipulation and.
Shadows Computer Graphics. Shadows Shadows Extended light sources produce penumbras In real-time, we only use point light sources –Extended light sources.
Erdem Alpay Ala Nawaiseh. Why Shadows? Real world has shadows More control of the game’s feel  dramatic effects  spooky effects Without shadows the.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 10: Computer Graphics Computer Science: An Overview Tenth Edition.
CSE 381 – Advanced Game Programming Basic 3D Graphics
Advanced Computer Graphics March 06, Grading Programming assignments Paper study and reports (flipped classroom) Final project No written exams.
Texture Mapping. Scope Buffers Buffers Various of graphics image Various of graphics image Texture mapping Texture mapping.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
CS 450: COMPUTER GRAPHICS REVIEW: INTRODUCTION TO COMPUTER GRAPHICS – PART 2 SPRING 2015 DR. MICHAEL J. REALE.
Week 2 - Friday.  What did we talk about last time?  Graphics rendering pipeline  Geometry Stage.
Advanced Computer Graphics Depth & Stencil Buffers / Rendering to Textures CO2409 Computer Graphics Week 19.
Visible-Surface Detection Jehee Lee Seoul National University.
CS 638, Fall 2001 Multi-Pass Rendering The pipeline takes one triangle at a time, so only local information, and pre-computed maps, are available Multi-Pass.
OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
CS-378: Game Technology Lecture #4: Texture and Other Maps Prof. Okan Arikan University of Texas, Austin V Lecture #4: Texture and Other Maps.
COMPUTER GRAPHICS CSCI 375. What do I need to know?  Familiarity with  Trigonometry  Analytic geometry  Linear algebra  Data structures  OOP.
Hidden Surface Removal 1.  Suppose that we have the polyhedron which has 3 totally visible surfaces, 4 totally invisible/hidden surfaces, and 1 partially.
Advanced Computer Graphics Advanced Shaders CO2409 Computer Graphics Week 16.
INT 840E Computer graphics Introduction & Graphic’s Architecture.
Game Programming 06 The Rendering Engine
Real-Time rendering Chapter 4.Visual Appearance 4.4. Aliasing and antialiasing 4.5. Transparency,alpha,and compositing 4.6. Fog 4.7. Gamma correction
09/16/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Environment mapping Light mapping Project Goals for Stage 1.
Texture Mapping CAP4730: Computational Structures in Computer Graphics.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Computer Graphics Blending CO2409 Computer Graphics Week 14.
Global Illumination. Local Illumination  the GPU pipeline is designed for local illumination  only the surface data at the visible point is needed to.
Lynwood Dunn ( ) Visual effects pioneer Acme-Dunn optical printer.
Lecture 6 Rasterisation, Antialiasing, Texture Mapping,
Single Pass Point Rendering and Transparent Shading Paper by Yanci Zhang and Renato Pajarola Presentation by Harmen de Weerd and Hedde Bosman.
Chapter III Rasterization
Maths & Technologies for Games Graphics Optimisation - Batching CO3303 Week 5.
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.
Visible-Surface Detection Methods. To identify those parts of a scene that are visible from a chosen viewing position. Surfaces which are obscured by.
Build your own 2D Game Engine and Create Great Web Games using HTML5, JavaScript, and WebGL. Sung, Pavleas, Arnez, and Pace, Chapter 5 Examples 1.
Lecture 30: Visible Surface Detection
Graphics Pipeline Bringing it all together. Implementation The goal of computer graphics is to take the data out of computer memory and put it up on the.
- Introduction - Graphics Pipeline
Textures, Sprites, and Fonts
Week 7 - Monday CS361.
Week 2 - Friday CS361.
Hidden Surface Removal
Chapter 10 Computer Graphics
The Graphics Rendering Pipeline
CS451Real-time Rendering Pipeline
Chapters VIII Image Texturing
Chapter III Modeling.
Chapter V Vertex Processing
UMBC Graphics for Games
CS-378: Game Technology Lecture #4: Texture and Other Maps
Chapter X Output Merger.
03 | Creating, Texturing and Moving Objects
Presentation transcript:

3D Graphics for Game Programming Chapter IV Fragment Processing and Output Merging

3D Graphics for Game Programming Fragment Processing  The per-fragment attributes may include a normal vector, a set of texture coordinates, a set of color values, a depth, etc.  Using these data, the fragment processing stage determines the final color of each fragment.  Two most important things to do in the fragment processing stage  Per-fragment lighting (presented in Chapter 5)  Texturing (presented in Chapters 8, 9, and 10).  Let’s see what texturing is

3D Graphics for Game Programming Texture Coordinates  The simplest among the various texturing methods is image texturing.  An image texture is a 2D array of texels (texture elements). Each texel has a unique address, i.e., 2D array index.  Let’s map the texture into a square in the parameter space and use normalized texture coordinates (u,v) instead of the texel address. Then, multiple images of different resolutions can be glued to a surface without changing the texture coordinates

3D Graphics for Game Programming Surface Parameterization  The texture coordinates are assigned to the vertices of the polygon mesh. This process is called surface parameterization or simply parameterization.  In general, parameterization requires unfolding a 3D surface onto a 2D planar domain

3D Graphics for Game Programming Chart and Atlas  The surface to be textured is often subdivided into a (hopefully small) number of patches.  Each patch is unfolded and parameterized. Then, the artist draws an image for each patch. An image for a patch is often called a chart.  Multiple charts are usually packed and arranged in a texture, which is often called an atlas

3D Graphics for Game Programming Texture Coordinates to Texel Address  Scan conversion is done with the texture coordinates.  D3D performs the following computation to convert the texture coordinates to the texel address

3D Graphics for Game Programming Texturing Examples  Observe that multiple images of different resolutions can be glued to a surface.

3D Graphics for Game Programming Texture Coordinates (revisited)  Direct3D and OpenGL adopt different parameter spaces for texture coordinates.  When a textured model is exported between Direct3D and OpenGL, the v- coordinates should be converted into (1-v).

3D Graphics for Game Programming Z-buffering  The output of the fragment program is often called the RGBAZ fragment.  A or alpha for representing the fragment's opacity  Z or depth used for z-buffering  Using alpha and depth values, the fragment competes or is merged with the pixel of the color buffer.  The z-buffer has the same resolution as the color buffer, and records the z- values of the pixels currently stored in the color buffer.  When a fragment at (x,y) is passed from the fragment program, its z-value is compared with the z-buffer value at (x,y).  If the fragment has a smaller z-value, its color and z-value are used to update the color buffer and z-buffer at (x,y), respectively.  Otherwise, the fragment is discarded.

3D Graphics for Game Programming Z-buffering (cont’d)  Assume MaxZ is 1.0, the red triangle’s depth is 0.8, and the blue triangle’s is 0.5.

3D Graphics for Game Programming Z-buffering (cont’d)  Rendering-order independence!!

3D Graphics for Game Programming Ed Catmull  Founder of Pixar and now president of Walt Disney and Pixar Animation Studios  Academy awards  1993 Academy Scientific and Technical Award "for the development of PhotoRealistic RenderMan software which produces images used in motion pictures from 3D computer descriptions of shape and appearance"  1996 Academy Scientific and Technical Award "for pioneering inventions in Digital Image Compositing"  2001 Oscar "for significant advancements to the field of motion picture rendering as exemplified in Pixar's RenderMan"  2008 Gordon E. Sawyer Award “for an individual in the motion picture industry whose technological contributions have brought credit to the industry“  Ed Catmull’s work  texture mapping  z-buffering  bicubic patches and subdivision surfaces

3D Graphics for Game Programming Alpha Blending  The alpha channel in the range of [0,1]  0 denotes “fully transparent.”  1 denotes “fully opaque.”  A typical blending equation is described as follows:  For alpha blending, the primitives cannot be rendered in an arbitrary order. They must be rendered after all opaque primitives, and in back-to-front order. Therefore, the partially transparent objects should be sorted.

3D Graphics for Game Programming Z-culling  The z-buffering test is done after the fragment processing stage. When the z- value of the fragment is greater than the buffered value, the fragment is determined to be occluded and thus discarded. It’s inefficient!!!  Let’s kill the fragments “before the fragment processing stage” if possible.  A tile is composed of n x n pixels, and records the maximum among their z-values.  Let’s compare it with the minimum z-coordinate of the three vertices of a triangle.

3D Graphics for Game Programming Z-culling (cont’d)  Z-culling is powerful, and is enabled by default.  Consider the scene, where the first object occludes almost of triangles of the other objects.  In a test, the average frame rate with the front-to-back ordered objects is fps whereas that with the back-to-front ordered objects is  This shows that the triangles may need to be sorted in front-to-back order in order to maximize the performance increase brought by z-culling.

3D Graphics for Game Programming Pre-Z Pass  Two-pass algorithm  1 st pass: The scene is rendered with no shading, e.g., no lighting and no texturing. Then, the color buffer is not filled, but the z-buffer is filled with the depths of the visible surfaces of the scene.  2 nd pass: The scene is rendered with full shading. Then, z-culling may cull out all fragments that are occluded by the visible surfaces. No occluded fragment enters the fragment processing stage.  The pre-Z pass algorithm even with back-to-front ordered objects outperforms the single-pass front-to-back rendering.