7.1 si31_2001 SI31 Advanced Computer Graphics AGR Lecture 7 Polygon Shading Techniques.

Slides:



Advertisements
Similar presentations
© 2008 Pearson Addison Wesley. All rights reserved Chapter Seven Costs.
Advertisements

Copyright © 2003 Pearson Education, Inc. Slide 1 Computer Systems Organization & Architecture Chapters 8-12 John D. Carpinelli.
Chapter 1 The Study of Body Function Image PowerPoint
Copyright © 2011, Elsevier Inc. All rights reserved. Chapter 6 Author: Julia Richards and R. Scott Hawley.
Author: Julia Richards and R. Scott Hawley
1 Copyright © 2013 Elsevier Inc. All rights reserved. Appendix 01.
UNITED NATIONS Shipment Details Report – January 2006.
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
FACTORING ax2 + bx + c Think “unfoil” Work down, Show all steps.
Polygon Scan Conversion – 11b
ENV Envisioning Information Lecture 13 – Scientific Visualization Scalar 3D Data: Isosurfacing Ken Brodlie
1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 9 Adding Realism Through Texture.
1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 18 Image-based Rendering Final Review of Rendering What We Did Not Cover Learning More...
Data Visualization Lecture 4 Two Dimensional Scalar Visualization
GR2 Advanced Computer Graphics AGR
Visualization Techniques -
GR2 Advanced Computer Graphics AGR
1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 6 Physically Based Reflection Model.
15.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 15 – Visible Surfaces and Shadows.
GR2 Advanced Computer Graphics AGR
SI23 Introduction to Computer Graphics
SI23 Introduction to Computer Graphics
GR2 Advanced Computer Graphics AGR
1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 16 Radiosity - continued.
16.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 16 – Some Special Rendering Effects.
1.1 SI31_2001 SI31 Advanced Computer Graphics AGR Ken Brodlie Lecture 1 - Overview.
5.1 si31_2001 SI31 Advanced Computer Graphics AGR Lecture 5 A Simple Reflection Model.
9.1si31_2001 SI31 Advanced Computer Graphics AGR Lecture 9 Adding Realism Through Texture.
SI31 Advanced Computer Graphics AGR
8.1si31_2001 SI31 Advanced Computer Graphics AGR Lecture 8 Polygon Rendering.
13.1 si31_2001 SI31 Advanced Computer Graphics AGR Lecture 13 An Introduction to Ray Tracing.
REVIEW: Arthropod ID. 1. Name the subphylum. 2. Name the subphylum. 3. Name the order.
2 |SharePoint Saturday New York City
Green Eggs and Ham.
VOORBLAD.
Constant, Linear and Non-Linear Constant, Linear and Non-Linear
Factor P 16 8(8-5ab) 4(d² + 4) 3rs(2r – s) 15cd(1 + 2cd) 8(4a² + 3b²)
Basel-ICU-Journal Challenge18/20/ Basel-ICU-Journal Challenge8/20/2014.
1..
Computer Graphics An Introduction. What’s this course all about? 05/10/2014 Lecture 1 2 We will cover… Graphics programming and algorithms Graphics data.
© 2012 National Heart Foundation of Australia. Slide 2.
Understanding Generalist Practice, 5e, Kirst-Ashman/Hull
Splines IV – B-spline Curves
Splines I – Curves and Properties
Model and Relationships 6 M 1 M M M M M M M M M M M M M M M M
25 seconds left…...
Analyzing Genes and Genomes
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
Intracellular Compartments and Transport
PSSA Preparation.
Essential Cell Biology
13- 1 Chapter 13: Color Processing 。 Color: An important descriptor of the world 。 The world is itself colorless 。 Color is caused by the vision system.
Computer Graphics Inf4/MSc Computer Graphics Lecture 13 Illumination I – Local Models.
©Larry F. Hodges (modified by Amos Johnson) 1 Shading Models.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Shading Week 5, Wed 1 Oct 2003 recap: lighting shading.
Polygon Shading. Assigning color to a shape to make graphical scenes look realistic, or artistic, or whatever effect we’re attempting to achieve But first.
CS 445 / 645 Introduction to Computer Graphics Lecture 18 Shading Shading.
COMPUTER GRAPHICS CS 482 – FALL 2014 AUGUST 27, 2014 FIXED-FUNCTION 3D GRAPHICS MESH SPECIFICATION LIGHTING SPECIFICATION REFLECTION SHADING HIERARCHICAL.
COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 1 Shading (Shading) & Smooth Shading Graphics.
Komputer Grafik 2 (AK045206) Shading 1/17 Realisme : Shading.
Illumination and Shading
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
Local Illumination and Shading
Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived color and intensity? Known as Lighting Model,
Illumination and Shading. Illumination (Lighting) Model the interaction of light with surface points to determine their final color and brightness OpenGL.
Chapter 14 Shading Models.
Chapter 14 Shading Models.
Presentation transcript:

7.1 si31_2001 SI31 Advanced Computer Graphics AGR Lecture 7 Polygon Shading Techniques

7.2 si31_2001 Reflection Models n We have seen how the reflected intensity at a point may be calculated – either by the Phong model or the physically-based Cook and Torrance model n A reminder of the Phong reflection model...

7.3 si31_2001 Phong Reflection Model light source N L R V eye surface I( ) = K a ( )I a ( ) + ( K d ( )( L. N ) + K s ( R. V ) n ) I*( ) / dist In practice, we evaluate I RED, I GREEN, I BLUE for red, green, blue intensities: I RED = K a RED I a RED + ( K d RED ( L. N ) + K s ( R. V ) n ) I* RED /dist Note: R.V calculation replaced by H.N for speed - H = (L+V)/2 dist = distance attenuation factor

7.4 si31_2001 Phong Reflection Model n Remember calculation depends on: – surface normal at a point – light source intensity and position – material properties – viewer position n L.N and H.N constant if L, V taken to be far away

7.5 si31_2001 Viewing Polygons n We have also seen how a 3D polygon can be projected to screen space via a sequence of transformations This lecture looks at how we shade the polygon, using our reflection model

7.6 si31_2001 Constant (or Flat) Shading n Calculate normal (how?) n Assume L.N and R.V constant (light & viewer at infinity) n Calculate I RED, I GREEN, I BLUE using Phong reflection model n Use scan line conversion to fill polygon N light viewer

7.7 si31_2001 2D Graphics - Filling a Polygon n Scan line methods used to fill 2D polygons with a constant colour – find ymin, ymax of vertices – from ymin to ymax do: – find intersection with polygon edges – fill in pixels between intersections using specified colour See: Hearn&Baker, Ch 3 - or try applet at: ~chinkw/FillPoly

7.8 si31_2001 Polygonal Models n Recall that we use polygonal models to approximate curved surfaces Constant shading will emphasise this approximation because each facet will be constant shaded, with sudden change from facet to facet

7.9 si31_2001 Flat Shading

7.10 si31_2001 Gouraud Shading n Gouraud shading attempts to smooth out the shading across the polygon facets n Begin by calculating the normal at each vertex N

7.11 si31_2001 Gouraud Shading averaging n A feasible way to do this is by averaging the normals from surrounding facets intensities n Then apply the reflection model to calculate intensities at each vertex N

7.12 si31_2001 Gouraud Shading linear interpolation n We use linear interpolation to calculate intensity at edge intersection P I P RED = (1- I P1 RED + I P2 RED where P divides P1P2 in the ratio n Similarly for Q P4 P2 P1 P3 P Q 1-

7.13 si31_2001 Gouraud Shading n Then we do further linear interpolation to calculate colour of pixels on scanline PQ P2 P1 P3 P Q

7.14 si31_2001 Gouraud Shading

7.15 si31_2001 Gouraud Shading Limitations - Specular Highlights n Gouraud shading gives intensities within a polygon which are a weighted average of the intensities at vertices – a specular highlight at a vertex tends to be smoothed out over a larger area than it should cover – a specular highlight in the middle of a polygon will never be shown

7.16 si31_2001 Gouraud Shading Limitations - Mach Bands n The rate of change of pixel intensity is even across any polygon, but changes as boundaries are crossed Mach banding n This discontinuity is accentuated by the human visual system, so that we see either light or dark lines at the polygon edges - known as Mach banding

7.17 si31_2001 Phong Shading n Phong shading has a similar first step, in that vertex normals are calculated - typically as average of normals of surrounding faces N

7.18 si31_2001 Phong Shading n However rather than calculate intensity at vertices and then interpolate intensities as we do in Gouraud shading... n In Phong shading we interpolate normals at each pixel... P4 P2 P1 P3 P Q N2 N1 N

7.19 si31_2001 Phong Shading n... and apply the reflection model at each pixel to calculate the intensity - I RED, I GREEN, I BLUE P4 P2 P1 P3 P Q N2 N1 N

7.20 si31_2001 Phong Shading

7.21 si31_2001 Phong versus Gouraud Shading n A major advantage of Phong shading over Gouraud is that specular highlights tend to be much more accurate – vertex highlight is much sharper – a highlight can occur within a polygon n Also Mach banding greatly reduced n The cost is a substantial increase in processing time because reflection model applied per pixel n But there are limitations to both Gouraud and Phong

7.22 si31_2001 Gouraud versus Phong

7.23 si31_2001 Interpolated Shading Limitations - Perspective Effects n Anomalies occur because interpolation is carried out in screen space, after the perspective transformation n Suppose P2 much more distant than P1. P is midway in screen space so gets 50 : 50 intensity (Gouraud) or normal (Phong) n... but in world coordinates it is much nearer P1 than P2 P4 P2 P1 P3 P Q

7.24 si31_2001 Interpolated Shading Limitations - Averaging Normals n Averaging the normals of adjacent faces usually works reasonably well n But beware corrugated surfaces where the averaging unduly smooths out the surface

7.25 si31_2001 Wall Lights

7.26 si31_2001 Wall Lights with Fewer Polygons

7.27 si31_2001 Final Note on Normals n If a sharp polygon boundary is required, we calculate two vertex normals for each side of the joint N LEFT N RIGHT

7.28 si31_2001 Simple Shading - Without Taking Account of Normals

7.29 si31_2001 Constant or Flat Shading - Each Polygon has Constant Shade

7.30 si31_2001 Gouraud Shading

7.31 si31_2001 Phong Shading

7.32 si31_2001 Phong Shading with Curved Surfaces

7.33 si31_2001 Better Illumination Model

7.34 si31_2001 Further Study n Hearn and Baker, section 14-5 n Watt, chapter 6 n Think about the relative computational costs of flat, Gouraud and Phong

7.35 si31_2001 Acknowledgements n Thanks again to Alan Watt for the images n The following sequence is the famous Shutterbug from Foley et al