Environmental Mapping CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.

Slides:



Advertisements
Similar presentations
1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 18 Image-based Rendering Final Review of Rendering What We Did Not Cover Learning More...
Advertisements

Lecture 8 Transparency, Mirroring
Virtual Realism TEXTURE MAPPING. The Quest for Visual Realism.
Graphics Pipeline.
Course Note Credit: Some of slides are extracted from the course notes of prof. Mathieu Desburn (USC) and prof. Han-Wei Shen (Ohio State University). CSC.
Texture Mapping. Texturing  process that modifies the appearance of each point on a surface using an image or function  any aspect of appearance can.
OpenGL Texture Mapping
Week 9 - Wednesday.  What did we talk about last time?  Fresnel reflection  Snell's Law  Microgeometry effects  Implementing BRDFs  Image based.
Reflections from Bumpy Surfaces GPU Graphics. What are we trying to achieve?  Most surfaces are not flat like glass  Some of these surfaces still give.
Based on slides created by Edward Angel
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Shading I.
Chapter 6: Vertices to Fragments Part 2 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 12 Solid Textures Bump Mapping Environment Mapping.
CS4395: Computer Graphics 1 Bump Mapping Mohan Sridharan Based on slides created by Edward Angel.
Based on slides created by Edward Angel
18.1 Si31_2001 SI31 Advanced Computer Graphics AGR Lecture 18 Image-based Rendering Light Maps What We Did Not Cover Learning More...
Texture Mapping CPSC /24/03 Abhijeet Ghosh.
Environmental Maps Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University.
ENVIRONMENT MAPPING. Kriglstein, WallnerEnvironment mapping2 INTRODUCTION What is environment mapping? Parameterization Prefiltering & Phong Model Fresnel.
Vertices and Fragments III Mohan Sridharan Based on slides created by Edward Angel 1 CS4395: Computer Graphics.
TA: Zhicheng Yan, Sushma S Kini, Mary Pietrowicz
Mohan Sridharan Based on slides created by Edward Angel GLSL I 1 CS4395: Computer Graphics.
Representation CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Classical Viewing CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Texture Mapping Mohan Sridharan Based on slides created by Edward Angel 1 CS4395: Computer Graphics.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Models and Architectures Ed Angel Professor of Computer Science, Electrical and Computer.
Direct Volume Rendering w/Shading via Three- Dimensional Textures.
Computer Graphics Inf4/MSc Computer Graphics Lecture 11 Texture Mapping.
1 Texturing. 2 What is Texturing? 3 Texture Mapping Definition: mapping a function onto a surface; function can be:  1, 2, or 3D  sampled (image) or.
1 Computer Graphics Week13 –Shading Models. Shading Models Flat Shading Model: In this technique, each surface is assumed to have one normal vector (usually.
Advanced Texturing Methods Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, December 8, 2003.
Environment Mapping. Examples Fall Motivation Silver candlestick No appropriate texture for it “ environment ” map Simulates the results of ray-tracing.
Fundamentals of Computer Graphics Part 9 Discrete Techniques prof.ing.Václav Skala, CSc. University of West Bohemia Plzeň, Czech Republic ©2002 Prepared.
1 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Textures and shadows  Generation  Mipmap  Texture coordinates,
Texture Mapping. Scope Buffers Buffers Various of graphics image Various of graphics image Texture mapping Texture mapping.
Texture Mapping. Example Mappings Mapping Techniques Consider the problem of rendering a sphere in the examples The geometry is very simple - a sphere.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
CS 376 Introduction to Computer Graphics 04 / 16 / 2007 Instructor: Michael Eckmann.
ECSE-4750 Computer Graphics Fall 2004 Prof. Michael Wozny TA. Abhishek Gattani TA. Stephen
CS 638, Fall 2001 Today Project Stage 0.5 Environment mapping Light Mapping.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CS-378: Game Technology Lecture #4: Texture and Other Maps Prof. Okan Arikan University of Texas, Austin V Lecture #4: Texture and Other Maps.
CS 480/680 Computer Graphics OpenGL Texture Mapping Dr. Frederick C Harris, Jr. Fall 2011.
Representation. Objectives Introduce concepts such as dimension and basis Introduce coordinate systems for representing vectors spaces and frames for.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
More on Environment Mapping Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, December 10, 2003.
October 9, 2002Serguei A. Mokhov, 1 COMP471 – Computer Graphics OpenGL: Texture Mapping.
Computer Graphics Lecture 08 Fasih ur Rehman. Last Class Ray Tracing.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Computer Graphics (Spring 2003) COMS 4160, Lecture 18: Shading 2 Ravi Ramamoorthi Guest Lecturer: Aner Benartzi.
CSCE 441: Computer Graphics Ray Tracing
11/24/ :45 Graphics II Shadow Maps Reflections Session 5.
Module 06 –environment mapping Module 06 – environment mapping Module 06 Advanced mapping techniques: Environment mapping.
OpenGL Vertex Arrays OpenGL vertex arrays store vertex properties such as coordinates, normal vectors, color values and texture coordinates. These properties.
MP3.. Start at the very beginning. Almost. Either start from nothing yourself, or use the empty template for this MP. Run through the provided files are.
Texture Coordinates CS418 Computer Graphics John C. Hart.
Module 05 –Bump mapping Module 05 – Bump mapping Module 05 Advanced mapping techniques: Bump mapping.
CS 376 Introduction to Computer Graphics 04 / 13 / 2007 Instructor: Michael Eckmann.
Viewing. Classical Viewing Viewing requires three basic elements - One or more objects - A viewer with a projection surface - Projectors that go from.
Texture Mapping CEng 477 Introduction to Computer Graphics.
Environment Maps Ed Angel Professor Emeritus of Computer Science
Introduction to Computer Graphics with WebGL
OpenGL Texture Mapping
CSC461: Lecture 23 Shading Computation
Michael Tanaya , Hua ming Chen
Introduction to Computer Graphics with WebGL
OpenGL Texture Mapping
Environment Mapping.
Presentation transcript:

Environmental Mapping CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel

Introduction Environmental mapping creates the appearance of highly reflective surfaces without ray tracing which requires global calculations. Examples: The Abyss, Terminator 2 Is a form of texture mapping: – Supported by OpenGL and Cg. CS4395: Computer Graphics 2

Example CS4395: Computer Graphics 3

Reflecting the Environment CS4395: Computer Graphics 4 V N R

Mapping to a Sphere CS4395: Computer Graphics 5 V N R

Hemisphere Map as a Texture If we map all objects to hemisphere, we cannot tell if they are on the sphere or anywhere else along the reflector. Use the map on the sphere as a texture that can be mapped onto the object. Can use other surfaces as the intermediate: – Cube maps. – Cylinder maps. CS4395: Computer Graphics 6

Issues Must assume environment is very far from object (equivalent to the difference between near and distant lights). Object cannot be concave (no self reflections possible). No reflections between objects. Need a reflection map for each object. Need a new map if viewer moves. CS4395: Computer Graphics 7

OpenGL Implementation OpenGL supports spherical and cube maps. First form map : – Use images from a real camera. – Form images with OpenGL. Texture map it on to object. CS4395: Computer Graphics 8

Cube Map CS4395: Computer Graphics 9

Forming Cube Map Use six cameras, each with a 90 degree angle of view. CS4395: Computer Graphics 10

Indexing into Cube Map CS4395: Computer Graphics 11 V R Compute R = 2(N·V)N-V Object at origin. Use largest magnitude component of R to determine face of cube. Other two components give texture coordinates.

Example R = (-4, 3, -1). Same as R = (-1, 0.75, -0.25) Use face x = -1 and y = 0.75, z = Not quite right since cube defined by x, y, z = ± 1 rather than [0, 1] range needed for texture coordinates. Remap by s = ½ + ½ y, t = ½ + ½ z Hence, s =0.875, t = CS4395: Computer Graphics 12

Doing it in OpenGL glTextureMap2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, level, GL_RGBA, rows, columns, border, GL_RGBA, GL_UNSIGNED_BYTE, image1) Same for other five images. Make one texture object out of the six images. CS4395: Computer Graphics 13

OpenGL Cube Map (cont) Parameters apply to all six images. glTEXParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAP_WRAP_S, GL_REPEAT); Same for t and r. Note that texture coordinates are in 3D space (s, t, r). CS4395: Computer Graphics 14

OpenGL Cube Map (cont) Usually use automatic texture coordinate generation via glTexGen*() glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP); glEnable(GL_TEXTURE_GEN, S); Same for t and r. glEnable(GL_TEXTURE_CUBE_MAP); CS4395: Computer Graphics 15

Normal Mapping Similar to texture mapping from cube. glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP); Store normals as textures on cube. Provides fast normal access. Works if textures stored at low precision (8 bits/component). CS4395: Computer Graphics 16

Recap: Texture Objects Allows us to store more than one texture (the current texture) in texture memory. Texture object stores texels and all parameters. Four steps: – Get name. – Bind. – Check for space (optional). – Bind and rebind. CS4395: Computer Graphics 17

Naming Texture Objects Names are unsigned ints. glGenTextures( GLsize n, Glint *tnames) returns n unused texture names in array ‘tnames’. GLuint tnames[10], decal; glGenTextures(10, tnames); decal = tnames[0] Can pass decal to Cg program (later). CS4395: Computer Graphics 18

Binding Textures First call moves object to texture memory. Subsequent calls make this object the current texture. glBindTexture(GLenum target, GLuint tname) glBindTexture(GL_TEXTURE_CUBE_ MAP, decal) Can also prioritize, check if space available, and delete. CS4395: Computer Graphics 19

Spherical Map Original environmental mapping technique proposed by Blinn and Newell. CS4395: Computer Graphics 20

Spherical Map 21 CS4395: Computer Graphics

Unraveled CS4395: Computer Graphics 22

Dome Master and Final Image 23 CS4395: Computer Graphics

Slicing Dome Master sequence is sliced, feathered, and gamma corrected for 6 projector system. 24 CS4395: Computer Graphics