Computer Graphicsgraphics Shading

Total Page:16

File Type:pdf, Size:1020Kb

Computer Graphicsgraphics Shading ComputerComputer GraphicsGraphics Shading The Physics Illumination Models & Shading 2 Local vs. Global Illumination Models Light Sources Point source (A): All light originates at a point Local model – direct Rays hit planar surface at different incidence angles and local interaction of Parallel source (B): All light rays are parallel each object with the Rays hit a planar surface at identical incidence angles light. May be modeled as point source at infinity Also called directional source Area source (C): Light originates at finite area in Global model : space. interactions and Inbetween the point and parallel sources exchange of light B C energy between Also called distributed source A different objects. 3 4 Diffuse Light Ambient Light Dull surfaces such as solid matte plastic reflects incoming light Assume non-directional light in the environment uniformly in all directions. Called diffuse or Lambertian reflection Object illuminated with same light everywhere Understand intensity as the number of photons per inch 2. If a flow Looks like silhouette of photos passing an inch 2 window is hitting a the red surface, how many photons hit an inch 2 of the surface ? The Illumination equation I = I k θ a a Let is the angle between the direction of incoming light and Ia - ambient light normal to surface, and let L, N be corresponding unit vectors. intensity x1 The length of the segment ka - fraction of 1 x θ ambient light reflected x is 1/cos . 1 2 from surface. L θ The amount of incident x3 Also defines object 1 N light per unit surface area (thus reflected light) is color proportional to cos θ =N•L 5 Copyright Gotsman, Elber, Barequet, Karni, Sheffer Page Computer Science, Technion ComputerComputer GraphicsGraphics Shading Diffused Ball Moon Paradox Diffuse Reflection Specular Reflection Illumination equation is now: Shiny objects (e.g. metallic) reflect light in preferred = + ⋅= + θ direction R determined by surface normal N. I Ikaa IkNL pd( ) Ik aa Ik pd cos N Ip - point light source’s intensity L R θ θ α kd - surface diffuse reflection coefficient V Most objects are not ideal mirrors – also reflect in the immediate vicinity of R Phong Model – approximate attenuation by the form of cos nα (no real physical basis) Question : Can we locate the light source from a shaded image ? 9 10 Specular Reflection (Phong Model) Specular Reflection (cont’d) Illumination equation: Exponent n of cosine controls = + ( ⋅ + ⋅ n ) I Iaka I p kd (N L) ks (R V) decay factor of attenuation ks - Specular reflection coefficient function: n - Specularity exponent No physical basis but looks good: 11 12 Copyright Gotsman, Elber, Barequet, Karni, Sheffer Page Computer Science, Technion ComputerComputer GraphicsGraphics Shading More on Illumination Equation Even More on Illumination Equation For multiple light sources: shadingmodel For distance/atmospheric attenuation sources: n I = I k + I (k (N ⋅ L ) + k (R ⋅V ) ) I p a a ∑ p d p s p I = I k + ()k (N ⋅ L ) + k (R ⋅V )n p a a ∑ d p s p p d p Ip of all light sources are added together Precautions should be taken from overflows dp - distance between surface and light source and/or distance between surface and viewer (heuristic atmospheric attenuation) 13 14 Flat Shading Normal per Vertex Applied to piecewise linear polygonal models Simple surface lighting approximated over polygons Illumination value depends only on polygon normal ⇒ each polygon is colored with a uniform intensity Looks non-smooth (worsened If a polyhedron is an approximation of smooth by Mach band effect) surface: • Assign to each vertex the normal of original surface at that point • If surface is not available use estimated normal (e.g. average of neighboring faces). 15 16 Gouraud Shading Gouraud Shading Linearly interpolate lighting intensities at the vertices over interior pixels of the polygon, in the image plane Compute illumination intensity at vertices using those normals Interpolate intensity over polygon interior Question : Can Gouraud shading support specular lighting? 17 18 Copyright Gotsman, Elber, Barequet, Karni, Sheffer Page Computer Science, Technion ComputerComputer GraphicsGraphics Shading Phong Shading Comments on Shading Interpolate (at the vertices in image space) normal Phong shading is more expensive (why?) but well vectors instead of illumination intensities worth the effort Apply the illumination equation for each interior pixel Can achieve good looking specular highlight effects with its own (interpolated) normal Both the Gouraud and Phong shading schemes are performed in the image plane and fit well into a polygonal scan-conversion fill scheme Both the Gouraud and Phong are view dependent Can cause artifacts during animation as they are transformation dependent 19 20 Comparison 21 Copyright Gotsman, Elber, Barequet, Karni, Sheffer Page Computer Science, Technion.
Recommended publications
  • BRDF, Reflection Integral
    CMSC740 Advanced Computer Graphics Spring 2020 Matthias Zwicker Today Simulating light transport • BRDF & reflection integral • BRDF examples 2 Surface appearance • How is light reflected by a – Mirror – White sheet of paper – Blue sheet of paper – Glossy metal 3 The BRDF (bidirectional reflectance distribution function) http://en.wikipedia.org/wiki/Bidirectional_reflectance_distribution_function • Describes quantitatively how light is reflected off a surface • “For every pair of light and viewing directions, BRDF gives fraction of transmitted light” • Captures appearance of surface Diffuse reflection Glossy reflection 4 The BRDF (bidirectional reflectance distribution function) http://en.wikipedia.org/wiki/Bidirectional_reflectance_distribution_function Relation of BRDF to physics • BRDF is not a model that explains light scattering on surfaces based on first principles • Instead, BRDF is just a quantitative description of overall result of light scattering for a given type of material 5 Types of reflection • Diffuse – Matte paint • Glossy – Plastic, high-gloss paint • Perfect specular – Mirror • Retro-reflective – Surface of the moon http://en.wikipedia.org/wiki/Retroreflector • Natural surfaces are often combinations 6 Mathematical formulation • Preliminaries: differential irradiance on surface due to incident radiance Li within a small cone of around direction ωi 7 Mathematical formulation • BRDF is fraction of reflected radiance in outgoing direction ωo over differential irradiance 8 Reflection equation • Outgoing radiance due to
    [Show full text]
  • CSE 167: Introduction to Computer Graphics Lecture #6: Illumination Model
    CSE 167: Introduction to Computer Graphics Lecture #6: Illumination Model Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2015 Announcements Project 3 due this Friday at 1pm Grading starts at 12:15 in CSE labs 260+270 Next Thursday: Midterm Midterm discussion on Monday at 4pm 2 Lecture Overview Depth Testing Illumination Model 3 Visibility • At each pixel, we need to determine which triangle is visible 4 Painter’s Algorithm Paint from back to front Every new pixel always paints over previous pixel in frame buffer Need to sort geometry according to depth May need to split triangles if they intersect Outdated algorithm, created when memory was expensive 5 Z-Buffering Store z-value for each pixel Depth test During rasterization, compare stored value to new value Update pixel only if new value is smaller setpixel(int x, int y, color c, float z) if(z<zbuffer(x,y)) then zbuffer(x,y) = z color(x,y) = c z-buffer is dedicated memory reserved for GPU (graphics memory) Depth test is performed by GPU 6 Z-Buffering in OpenGL In your application: Ask for a depth buffer when you create your window. Place a call to glEnable (GL_DEPTH_TEST) in your program's initialization routine. Ensure that your zNear and zFar clipping planes are set correctly (in glOrtho, glFrustum or gluPerspective) and in a way that provides adequate depth buffer precision. Pass GL_DEPTH_BUFFER_BIT as a parameter to glClear. 7 Z-Buffering Problem: translucent geometry Storage of multiple depth and color values per pixel (not practical in real-time graphics) Or back to front rendering of translucent geometry, after rendering opaque geometry Does not always work correctly: programmer has to weight rendering correctness against computational effort 8 Lecture Overview Depth Testing Illumination Model 9 Shading Compute interaction of light with surfaces Requires simulation of physics “Global illumination” Multiple bounces of light Computationally expensive, minutes per image Used in movies, architectural design, etc.
    [Show full text]
  • Material Category Determined by Specular Reflection Structure Mediates the Processing of Image Features for Perceived Gloss
    bioRxiv preprint doi: https://doi.org/10.1101/2019.12.31.892083; this version posted January 2, 2020. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY-NC-ND 4.0 International license. Material category determined by specular reflection structure mediates the processing of image features for perceived gloss Authors: Alexandra C. Schmid1, Pascal Barla2, Katja Doerschner1,3 1Justus Liebig University Giessen, Germany 2INRIA, University of Bordeaux, France 3Bilkent University, Turkey Correspondence: [email protected] (A.C.S.); [email protected] (P.B.); [email protected] (K.D.) 31.12.2019 1 bioRxiv preprint doi: https://doi.org/10.1101/2019.12.31.892083; this version posted January 2, 2020. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY-NC-ND 4.0 International license. ABSTRACT There is a growing body of work investigating the visual perception of material properties like gloss, yet practically nothing is known about how the brain recognises different material classes like plastic, pearl, satin, and steel, nor the precise relationship between material properties like gloss and perceived material class. We report a series of experiments that show that parametrically changing reflectance parameters leads to qualitative changes in material appearance beyond those expected by the reflectance function used.
    [Show full text]
  • Computer Graphics Lecture 8: Lighting and Shading
    CS130 : Computer Graphics Lecture 8: Lighting and Shading Tamar Shinar Computer Science & Engineering UC Riverside Why we need shading •Suppose we build a model of a sphere using many polygons and color each the same color. We get something like •But we want 2 The more realistically lit sphere has gradations in its color that give us a sense of its three-dimensionality Shading •Why does the image of a real sphere look like •Light-material interactions cause each point to have a different color or shade •Need to consider Light sources Material properties Location of viewer Surface orientation (normal) 3 We are going to develop a local lighting model by which we can shade a point independently of the other surfaces in the scene our goal is to add this to a fast graphics pipeline architecture General rendering • The most general approach is based on physics - using principles such as Shreiner] [Angel and conservation of energy • a surface either emits light (e.g., light bulb) or reflects light for other illumination sources, or both • light interaction with materials is recursive • the rendering equation is an integral equation describing the limit of this recursive process http://en.wikipedia.org/wiki/Rendering_equation Fast local shading models • the rendering equation can’t be solved analytically • numerical methods aren’t fast enough for real-time • for our fast graphics rendering pipeline, we’ll use a local model where shade at a point is independent of other surfaces • use Phong reflection model • shading based on local light-material
    [Show full text]
  • Estimating the Colour of the Illuminant Using Specular Reflection and Exemplar-Based Method
    ESTIMATING THE COLOUR OF THE ILLUMINANT USING SPECULAR REFLECTION AND EXEMPLAR-BASED METHOD by Hamid Reza Vaezi Joze B.Sc., Sharif University of Technology, 2006 M.Sc., Sharif University of Technology, 2008 A THESIS SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE DEGREE OF Doctor of Philosophy in the School of Computing Science Faculty of Applied Sciences c Hamid Reza Vaezi Joze 2013 SIMON FRASER UNIVERSITY Spring 2013 All rights reserved. However, in accordance with the Copyright Act of Canada, this work may be reproduced without authorization under the conditions for “Fair Dealing.” Therefore, limited reproduction of this work for the purposes of private study, research, criticism, review and news reporting is likely to be in accordance with the law, particularly if cited appropriately. APPROVAL Name: Hamid Reza Vaezi Joze Degree: Doctor of Philosophy Title of Thesis: Estimating The Colour of The Illuminant Using Specular Reflection and Exemplar-Based Method Examining Committee: Dr. Greg Mori, Associate Professor Chair Dr. Mark S. Drew, Senior Supervisor, Professor Dr. Ze-Nian Li, Supervisor, Professor Dr. Graham Finlayson, Supervisor, Professor, Computing Science, The University of East Anglia, UK Adjunct Professor, Computing Science, SFU Dr. Tim Lee, SFU Examiner Adjunct Professor, Computing Science Dr. Maria Vanrell, External Examiner, Associate Professor, Computer Science Universitat Autonoma` de Barcelona, Spain Date Approved: March 11th, 2013 ii Partial Copyright Licence Abstract In this thesis, we propose methods for estimation of the colour of the illuminant. First, we investigate the effects of bright pixels on several current colour constancy algorithms. Then we use bright pixels to extend the seminal Gamut Mapping Colour Constancy algorithm.
    [Show full text]
  • Single-Image Specular Highlight Removal on the Gpu
    Recent Researches in Applied Informatics Single-Image Specular Highlight Removal On The Gpu COSTIN-ANTON BOIANGIU, RĂZVAN MĂDĂLIN OIŢĂ, MIHAI ZAHARESCU Computer Science Department “Politehnica” University of Bucharest Splaiul Independentei 313, Sector 6, Bucharest, 060042 ROMANIA [email protected], [email protected], [email protected] Abstract: Highlights on textured surfaces are linear combinations of diffuse and specular reflection components. It is sometimes necessary to separate these lighting elements or completely remove the specular light, especially as a preprocessing step for computer vision. Many methods have been proposed for separating the reflection components. The method presented in this article improves on an existing algorithm by porting it on the GPU in order to optimize the speed, using new features found in DirectX11. New test results are also offered. Key-Words: Specular Removal, GPU porting, DirectX11, computer vision 1 Introduction adapting their method to run on a modern GPU. Separation of diffuse and specular lighting This is done using the newest features of the components is an important subject in the field of DirectX11 API, allowing for random read and write computer vision, since many algorithms in the field access from and to buffers containing various types assume perfect diffuse surfaces. For example, a of data. stereo matching algorithm would expect to find similar changes in the positions of the detected regions of interest; however, the specular reflection 2 Related Work actually moves over the surface and doesn’t remain In computer graphics certain models are used to stuck to the same part of the object. Segmentation approximate the intensity distribution of lighting algorithms are highly influenced by the strong and components.
    [Show full text]
  • Local Illumination and Shading
    Local Illumination and Shading Computer Graphics – Lecture 5 Taku Komura [email protected] Institute for Perception, Action & Behaviour Taku Komura Computer Graphics What affects how the colour appears? The incident light • Position of light source • Direction • Its own color The object • Reflectance Viewer • Position Taku Komura Computer Graphics Overview Illumination (how to calculate the colour) Shading (how to colour the whole surface)? Taku Komura Computer Graphics Illumination Simple 3 parameter model − The sum of 3 illumination terms: • Ambient : 'background' illumination • Specular : bright, shiny reflections • Diffuse : non-shiny illumination and shadows + + = Ambient Diffuse Specular Rc (colour) (directional) (highlights) Taku Komura Computer Graphics Ambient Lighting − Light from the environment — light reflected or scattered from other objects — Coming uniformly from all directions — and then reflected equally to all directions − A precise simulation of such effects requires a lot of computation Object Taku Komura Computer Graphics Ambient Lighting Simple approximation to complex 'real-world' process Result: globally uniform colour for object I = resulting intensity Example: sphere Ia = light intensity ka = reflectance = Object I ka Ia Taku Komura Computer Graphics Diffuse Lighting • When light hits an object – If the object has a rough surface, it is reflected to various directions – If the object is translucent, it enters an object and traverses inside, before it goes out • Result: Light reflected to all directions – considers
    [Show full text]
  • Specular Reflection
    Image Processing and Computer Graphics Lighting Matthias Teschner Computer Science Department University of Freiburg Motivation modeling of visual phenomena light is emitted by light sources, e.g. sun or lamp light interacts with objects light is absorbed or scattered (reflected) at surfaces light is absorbed by a sensor, e.g. human eye or camera [Akenine-Möller et al.] University of Freiburg – Computer Science Department – Computer Graphics - 2 Outline light color lighting models shading models University of Freiburg – Computer Science Department – Computer Graphics - 3 Light modeled as electromagnetic waves, radiation photons geometric rays photons particles characterized by wavelength (perceived as color in the visible spectrum) carry energy (inversely proportional to the wavelength) travel along a straight line at the speed of light University of Freiburg – Computer Science Department – Computer Graphics - 4 Radiometric Quantities radiant energy Q photons have some radiant energy radiant flux , radiant power P rate of flow of radiant energy per unit time: e.g., overall energy of photons emitted by a source per time flux density (irradiance, radiant exitance) radiant flux per unit area: rate at which radiation is incident on, or exiting a flat surface area dA describes strength of radiation with respect to a surface area no directional information University of Freiburg – Computer Science Department – Computer Graphics - 5 Radiometric Quantities Irradiance irradiance measures the overall radiant flux (light
    [Show full text]
  • Rendering Specular Microgeometry with Wave Optics
    Rendering Specular Microgeometry with Wave Optics LING-QI YAN, University of California, Berkeley MILOŠ HAŠAN, Autodesk BRUCE WALTER, Cornell University STEVE MARSCHNER, Cornell University RAVI RAMAMOORTHI, University of California, San Diego geometric optics wave optics (our method) wave optics (our method) single wavelength spectral Fig. 1. We present the first practical method for rendering specular reflection from arbitrary high-resolution microstructure (represented as discretized heightfields) using wave optics. Left: Rendering with previous work [Yan et al. 2016], based on the rules of geometric optics. Middle: Using wave optics,even with a single fixed wavelength, our method generates a more natural appearance as compared to geometric optics. Right: A spectral rendering additionally shows subtle but important color glint effects. Insets show enlarged regions and representative BRDFs generated using each method. We encourage readersto zoom in to better see color and detail, and to view the full resolution supplementary images to see the subtle details in all ofthefigures. Simulation of light reflection from specular surfaces is a core problem of of a micron-resolution surface heightfield using Gabor kernels. We found computer graphics. Existing solutions either make the approximation of that the appearance difference between the geometric and wave solution is providing only a large-area average solution in terms of a fixed BRDF (ig- more dramatic when spatial detail is taken into account. The visualizations noring spatial detail), or are specialized for specific microgeometry (e.g. 1D of the corresponding BRDF lobes differ significantly. Moreover, the wave scratches), or are based only on geometric optics (which is an approximation optics solution varies as a function of wavelength, predicting noticeable to more accurate wave optics).
    [Show full text]
  • 5.2 Blinn-Phong Reflection Model
    5.2 Blinn-Phong Reflection Model Jacobs University Visualization and Computer Graphics Lab 320322: Graphics and Visualization 438 Blinn-Phong reflection model • The Blinn-Phong reflection model is a slight modification of the Phong reflection model. • The purpose of the modification is to speed up the computation. • The modification only affects the specular reflection. • The faster computation avoids the expensive computation of the reflected direction r of the light ray. Jacobs University Visualization and Computer Graphics Lab 320322: Graphics and Visualization 439 Blinn-Phong reflection model • It introduces the half-way vector • The specular highlight is brightest, if v = r, i.e., if n = h. •Theangle β between n and h can be used to compute the falloff of specular intensity. Jacobs University Visualization and Computer Graphics Lab 320322: Graphics and Visualization 440 Blinn-Phong reflection model • The Blinn-Phong reflection model replaces max (r•v, 0) with max (h•n, 0). •Weobtain Jacobs University Visualization and Computer Graphics Lab 320322: Graphics and Visualization 441 Blinn-Phong vs. Phong • The two models are not equal. • By adjusting the specular reflection exponent n, one can obtain results with both models that look alike. Jacobs University Visualization and Computer Graphics Lab 320322: Graphics and Visualization 442 5.3 BRDF Jacobs University Visualization and Computer Graphics Lab 320322: Graphics and Visualization 443 Motivation • Phong‘s diffuse reflection is based on the Lambertian model. • The reflection is equal in all directions. • It represents perfectly diffuse (matte) surfaces. • How can we model other surface reflections? Jacobs University Visualization and Computer Graphics Lab 320322: Graphics and Visualization 444 BRDF Bidirectional reflectance distribution function: • BRDF is a 4-dimensional function that defines how light is reflected at an opaque surface.
    [Show full text]
  • Gouraud Shading (Once Per Vertex)‏ – Phong Shading (Once Per Pixel)‏ → Heavy Computation Needed‏ Flat Shading
    Illumination and Shading Computer Graphics – Lecture 7 Taku Komura Outline • Lighting • How to compute the color of objects according to the position of the light, normal vector and camera position • Phong illumination model • Shading • Different methods to compute the color of the entire surface What We See is the Light Coming from Different Directions The eye works like a camera Lots of photo sensors at the back of the eye Sensing the amount of light coming from different directions Similar to CMOS and CCDs What Affects the Color of a Point on the Object? position of the sample point position of the light color and intensity of the light camera vector normal vector of the surface at the vertex physical characteristics of the object (reflectance model, color) Phong Illumination Model Simple 3 parameter model The sum of 3 illumination terms: • Diffuse : non-shiny illumination and shadows • Specular : bright, shiny reflections • Ambient : 'background' illumination + + = Diffuse Specular Ambient Rc (directional)‏ (highlights)‏ (color)‏ Diffuse Reflection •When light hits an object –If the object has a rough surface, it is reflected to various directions •Result: Light reflected to all directions • The smaller the angle between the incident vector and the normal vector, the higher the chance that the light is reflected back • When the angle is larger, the reflection light gets weaker because • the chance the light is shadowed / masked increases Diffuse Reflection Infinite point Ln (light) light source N (normal) Example: sphere (lit
    [Show full text]
  • Download 04 BRDF, Reflection Integral.Pdf
    CMSC740 Advanced Computer Graphics Spring 2021 Matthias Zwicker Today Simulating light transport • BRDF & reflection integral • BRDF examples 2 Surface appearance • How is light reflected by a – Mirror – White sheet of paper – Blue sheet of paper – Glossy metal 3 The BRDF (bidirectional reflectance distribution function) http://en.wikipedia.org/wiki/Bidirectional_reflectance_distribution_function • Describes quantitatively how light is reflected off a surface • “For every pair of light and viewing directions, BRDF gives fraction of transmitted light” • Captures appearance of surface Diffuse reflection Glossy reflection 4 The BRDF (bidirectional reflectance distribution function) http://en.wikipedia.org/wiki/Bidirectional_reflectance_distribution_function Relation of BRDF to physics • BRDF is not a model that explains light scattering on surfaces based on first principles • Instead, BRDF is just a quantitative description of overall result of light scattering for a given type of material 5 Types of reflection • Diffuse – Matte paint • Glossy – Plastic, high-gloss paint • Perfect specular – Mirror • Retro-reflective – Surface of the moon http://en.wikipedia.org/wiki/Retroreflector • Natural surfaces are often combinations 6 Mathematical formulation • Preliminaries: differential irradiance dE on surface due to incident radiance Li within a small cone of around direction ωi : angle between normal and ωi 7 Mathematical formulation • BRDF: given surface location x with normal n, BRDF is fraction of reflected radiance Lo in outgoing direction
    [Show full text]