CDS 301 Fall, 2008 From Graphics to Visualization Chap. 2 Sep. 3, 2009 Jie Zhang Copyright ©

Slides:



Advertisements
Similar presentations
Polygon Rendering Flat Rendering Goraud Rendering Uses Phong Reflectance Phong Rendering.
Advertisements

Graphics Pipeline.
1 Graphics CSCI 343, Fall 2013 Lecture 18 Lighting and Shading.
3D Graphics Rendering and Terrain Modeling
Virtual Realism LIGHTING AND SHADING. Lighting & Shading Approximate physical reality Ray tracing: Follow light rays through a scene Accurate, but expensive.
1 Computer Graphics Chapter 9 Rendering. [9]-2RM Rendering Three dimensional object rendering is the set of collective processes which make the object.
1. What is Lighting? 2 Example 1. Find the cubic polynomial or that passes through the four points and satisfies 1.As a photon Metal Insulator.
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Shading I.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Lighting/Shading III Week.
Computer Graphics - Class 10
IMGD 1001: Illumination by Mark Claypool
Computer Graphics (Fall 2005) COMS 4160, Lecture 16: Illumination and Shading 1
IN4151 Introduction 3D graphics 1 Introduction 3D Computer Graphics part 1 Projective display Viewing pipeline Graphics hardware Image-based rendering.
(conventional Cartesian reference system)
1 CSCE 641: Computer Graphics Lighting Jinxiang Chai.
7M836 Animation & Rendering
6.1 Vis_04 Data Visualization Lecture 6 - A Rough Guide to Rendering.
©Larry F. Hodges (modified by Amos Johnson) 1 Shading Models.
Coordinate Systems X Y Z (conventional Cartesian reference system) X Y Z.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Shading Week 5, Wed 1 Oct 2003 recap: lighting shading.
7/2/2006Based on: Angel (4th Edition) & Akeine-Möller & Haines (2nd Edition)1 CSC345: Advanced Graphics & Virtual Environments Lecture 4: Visual Appearance.
Lighting & Shading.
CS 480/680 Computer Graphics Shading I Dr. Frederick C Harris, Jr.
Fundamentals of Computer Graphics Part 6 Shading prof.ing.Václav Skala, CSc. University of West Bohemia Plzeň, Czech Republic ©2002 Prepared with Angel,E.:
CS 445 / 645 Introduction to Computer Graphics Lecture 18 Shading Shading.
Shading (introduction to rendering). Rendering  We know how to specify the geometry but how is the color calculated.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 10: Computer Graphics Computer Science: An Overview Tenth Edition.
COMPUTER GRAPHICS CS 482 – FALL 2014 AUGUST 27, 2014 FIXED-FUNCTION 3D GRAPHICS MESH SPECIFICATION LIGHTING SPECIFICATION REFLECTION SHADING HIERARCHICAL.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Chapter 10: Computer Graphics
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 10: Computer Graphics Computer Science: An Overview Tenth Edition.
COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 1 Shading (Shading) & Smooth Shading Graphics.
Computer Graphics An Introduction. What’s this course all about? 06/10/2015 Lecture 1 2 We will cover… Graphics programming and algorithms Graphics data.
Introduction to Scientific Visualization CS 4390/5390 Data Visualization Shirley Moore, Instructor October 13,
Rendering Overview CSE 3541 Matt Boggus. Rendering Algorithmically generating a 2D image from 3D models Raster graphics.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Basic Rendering Pipeline and Shading Spring 2012.
Illumination and Shading How to shade surfaces based on the position,orientation,characteristics of the surfaces and the light sources illuminating them.
Komputer Grafik 2 (AK045206) Shading 1/17 Realisme : Shading.
Illumination and Shading
Course Introduction to virtual engineering Óbuda University John von Neumann Faculty of Informatics Institute of Applied Mathematics Lecture and laboratory.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Surface Rendering Methods 고려대학교 컴퓨터 그래픽스 연구실.
CS 445 / 645 Introduction to Computer Graphics Lecture 15 Shading Shading.
RENDERING Introduction to Shading models – Flat and Smooth shading – Adding texture to faces – Adding shadows of objects – Building a camera in a program.
Global Illumination. Local Illumination  the GPU pipeline is designed for local illumination  only the surface data at the visible point is needed to.
RENDERING Introduction to Shading models – Flat and Smooth shading – Adding texture to faces – Adding shadows of objects – Building a camera in a program.
Visual Appearance Chapter 4 Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
11/5/2002 (c) University of Wisconsin, CS 559 Last Time Local Shading –Diffuse term –Specular term –All together –OpenGL brief overview.
Local Illumination and Shading
Illumination and Shading Prof. Lizhuang Ma Shanghai Jiao Tong University.
Where We Stand So far we know how to: –Transform between spaces –Rasterize –Decide what’s in front Next –Deciding its intensity and color.
Render methods. Contents Levels of rendering Wireframe Plain shadow Gouraud Phong Comparison Gouraud-Phong.
Illumination and Shading Sang Il Park Sejong University.
Lighting and Reflection Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
Computer Graphics Ken-Yi Lee National Taiwan University (the slides are adapted from Bing-Yi Chen and Yung-Yu Chuang)
Illumination and Shading. Illumination (Lighting) Model the interaction of light with surface points to determine their final color and brightness OpenGL.
Illumination and Shading Prof. Lizhuang Ma Shanghai Jiao Tong University.
Computer Graphics Chapter 9 Rendering.
Volume Visualization Chap. 10 November 20 , 2008 Jie Zhang Copyright ©
Chapter 10: Computer Graphics
Chapter 14 Shading Models.
CS5500 Computer Graphics May 29, 2006
Illumination and Shading
Texture Mapping 고려대학교 컴퓨터 그래픽스 연구실.
Chapter 14 Shading Models.
Illumination Model 고려대학교 컴퓨터 그래픽스 연구실.
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Presentation transcript:

CDS 301 Fall, 2008 From Graphics to Visualization Chap. 2 Sep. 3, 2009 Jie Zhang Copyright ©

Outline Example: make a 2-D Gaussian plot Data sampling Graphic Rendering Light Rendering Model Texture Mapping Transparency and Blending Visualization Pipeline

2-D Gaussian Function Compact Domain, Continuous Data A Continuous 3D Surface in 3-D Space

2-D Gaussian Function Sampling: Nx=30 Ny=30 Uniform grid in the domain space Mapping the 3-D surface to A set of four-vertex polygons, or quadrilateral

2-D Gaussian Function Quadrilateral in 3-D space: V1: (x, y, f(x,y)) V2: (x+dx, y, f(x+dx,y) V3: (x+dx, y+dy, f(x+dx,y+dy)) V4: (x, y+dy, f(x,y+dy)) These graphic primitives are rendered fast by computers A quad has uniform illumination or lighting on its surface, so called flat shading

2-D Gaussian Function Implementation: float X_min, X_max; float Y_min, Y_max; int N_x,N_y; float dx = (X_max-X_min)/N_x; float dy = (Y_max-Y_min)/N_y; float f(float,float); for (float x=X_min;x<=X_max-dy;x+=dx) for (float y=Y_min;y<=Y_max-dy;y+=dy) { Quad, q; q.addPoint (x,y, f(x,y)); q.addPoint (x+dx,y, f(x+dx,y)); q.addPoint (x+dx,y+dy, f(x+dx,y+dy)); q.addPoint (x,y+dy, f(x,y+dy)); }

Rendering: the basics Computer graphic rendering generate a computer image of 3D scene, for a given dataset Ingredients: A 3D scene A set of Lights A viewpoint How to determine the illumination of the primitive shapes in the 3-D scene?

Rendering Equations Rendering methods differ in approximating lighting effects Global illumination: ray tracing, accurate by computationally expensive Local illumination: relate the illumination of a given scene point directly to the light set, not to any other scene points Phong Local Lighting Model (OpenGL) Assuming that the scene consists of opaque objects in void space, illuminated by a point-like light source

Phong Local Lighting Model

I(p,v,L): intensity of the scene point I l : Intensity of the light p: location of the scene point V: direction vector from p to the viewpoint L: direction vector from the light to p n: surface normal at p r: direction of the reflecting light α: specular power α Three components: 1.C amb : ambient lighting, overall effect of other objects, assuming to be constant 2.C diff : diffuse lighting, scattering of the surface, equal in all direction; plastic surface 3.C spec : specular lighting, mirror-like surface

Primitive Shape Shading Flat shading: Given a polygon surface (e.g., quadrilateral), flat shading applies the lightening model once for the complete polygon, e.g., for the center point The whole polygon surface has the same light intensity The least expensive But visual artifact of the “faceted” surface Gouraud shading (or smooth shading): Apply lightening model at every vertex of the polygon The intensity between the vertices are calculated using interpolation, thus yielding smooth variation

Primitive Shape Shading Flat ShadingGouraud Shading

Implementation: glShadingMode(GL_FLAT); glColor3f(r,g,b) ;set material color glEnable(GL_LIGHTENING); glEnable(GL_LIGHT0); glLightfv(GL_LIGHT0,GL_POSITION,p); Primitive Shape Shading

Calculate Normal Direction Using gradient: Using normal averaging:

Texture Mapping Effectively simulate a wide range of appearance on the surface of a rendered object Improve the realism of visualization Method: pre-define a texture image, mapping the polygon vertex coordinates to texture coordinates, and then combine the texture color with the polygon color

Transparency and Blending Rendering translucent (or half-transparent) shape See multiple shapes at the same time e.g., the Gaussian surface and the underlying gridded domain Blending method (rendering the transparent effect) Source: the shape is being drawn Destination: the frame buffer (currently displayed image) Source + Destination

Transparency and Blending The Grid The Gaussian Surface

Transparency and Blending The blending output is a weighted combination of the source and the destination sf: source weight factor, [0,1] Also called alpha component df: destination weight factor, [0,1] sf and df: also called blending factors glBlendFunc(GL_SOURCE_ALPHA, GL_ONE); glColor4f(r,g,b,sf)

Visualization Pipeline float data[N_x,N_y] Class Quad Continuous data Discrete dataset Geometric object Displayed image Data Acquisition Data Mapping Rendering

End