Computer Graphics (CS 543) Lecture 10: Soft Shadows (Maps and Volumes), Normal and Bump Mapping

Similar documents
Computer Graphics (CS 543) Lecture 10: Normal Maps, Parametrization, Tone Mapping

Recall: Indexing into Cube Map

Shadow Algorithms. CSE 781 Winter Han-Wei Shen

Shadow Rendering EDA101 Advanced Shading and Rendering

Computergrafik. Matthias Zwicker. Herbst 2010

Computer Graphics (CS 543) Lecture 9b: Shadows and Shadow Maps. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Computer Graphics (CS 4731) Lecture 16: Lighting, Shading and Materials (Part 1)

Module Contact: Dr Stephen Laycock, CMP Copyright of the University of East Anglia Version 1

Computer Graphics (CS 543) Lecture 7b: Intro to lighting, Shading and Materials + Phong Lighting Model

CMSC427 Advanced shading getting global illumination by local methods. Credit: slides Prof. Zwicker

CS 354R: Computer Game Technology

Advanced Lighting Techniques Due: Monday November 2 at 10pm

Lecture 17: Shadows. Projects. Why Shadows? Shadows. Using the Shadow Map. Shadow Maps. Proposals due today. I will mail out comments

Deferred Rendering Due: Wednesday November 15 at 10pm

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

Real-Time Shadows. Last Time? Today. Why are Shadows Important? Shadows as a Depth Cue. For Intuition about Scene Lighting

Computer Graphics. Shadows

Computer Graphics 10 - Shadows

Pipeline Operations. CS 4620 Lecture 14

Advanced Shading I: Shadow Rasterization Techniques

Real-Time Shadows. Last Time? Textures can Alias. Schedule. Questions? Quiz 1: Tuesday October 26 th, in class (1 week from today!

Rasterization Overview

Real-Time Shadows. MIT EECS 6.837, Durand and Cutler

Painter s HSR Algorithm

Computer Graphics (CS 543) Lecture 8a: Per-Vertex lighting, Shading and Per-Fragment lighting

Computer Graphics CS 543 Lecture 1 (Part I) Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

CS230 : Computer Graphics Lecture 4. Tamar Shinar Computer Science & Engineering UC Riverside

Recollection. Models Pixels. Model transformation Viewport transformation Clipping Rasterization Texturing + Lights & shadows

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

Graphics and Interaction Rendering pipeline & object modelling

Chapter 7 - Light, Materials, Appearance

Computer Graphics (CS 543) Lecture 13b Ray Tracing (Part 1) Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Computer Graphics 1. Chapter 7 (June 17th, 2010, 2-4pm): Shading and rendering. LMU München Medieninformatik Andreas Butz Computergraphik 1 SS2010

Last Time. Why are Shadows Important? Today. Graphics Pipeline. Clipping. Rasterization. Why are Shadows Important?

Pipeline Operations. CS 4620 Lecture 10

TDA362/DIT223 Computer Graphics EXAM (Same exam for both CTH- and GU students)

For Intuition about Scene Lighting. Today. Limitations of Planar Shadows. Cast Shadows on Planar Surfaces. Shadow/View Duality.

Shadows. COMP 575/770 Spring 2013

CSE 167: Introduction to Computer Graphics Lecture #18: More Effects. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Computer Graphics (CS 543) Lecture 1 (Part 1): Introduction to Computer Graphics

Real-Time Shadows. Last Time? Schedule. Questions? Today. Why are Shadows Important?

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

6.837 Introduction to Computer Graphics Final Exam Tuesday, December 20, :05-12pm Two hand-written sheet of notes (4 pages) allowed 1 SSD [ /17]

CHAPTER 1 Graphics Systems and Models 3

CS Computer Graphics: Hidden Surface Removal

Acknowledgement: Images and many slides from presentations by Mark J. Kilgard and other Nvidia folks, from slides on developer.nvidia.

LOD and Occlusion Christian Miller CS Fall 2011

Mattan Erez. The University of Texas at Austin

CS Computer Graphics: Introduction to Ray Tracing

CS Computer Graphics: Introduction to Ray Tracing

CS 498 VR. Lecture 19-4/9/18. go.illinois.edu/vrlect19

CEng 477 Introduction to Computer Graphics Fall 2007

03 RENDERING PART TWO

C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE. Mikhail Bessmeltsev

The Application Stage. The Game Loop, Resource Management and Renderer Design

Homework #2. Shading, Ray Tracing, and Texture Mapping

What for? Shadows tell us about the relative locations. Vienna University of Technology 2

Computer Graphics (CS 563) Lecture 4: Advanced Computer Graphics Image Based Effects: Part 2. Prof Emmanuel Agu

CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions. The Midterm Exam was given in class on Thursday, October 23, 2008.

Shaders. Slide credit to Prof. Zwicker

CS 4620 Program 3: Pipeline

CSE 167: Introduction to Computer Graphics Lecture #6: Lights. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2014

Models and Architectures

Homework #2 and #3 Due Friday, October 12 th and Friday, October 19 th


Computer Graphics CS 543 Lecture 13a Curves, Tesselation/Geometry Shaders & Level of Detail

Overview: Ray Tracing & The Perspective Projection Pipeline

CS 498 VR. Lecture 18-4/4/18. go.illinois.edu/vrlect18

Illumination & Shading I

AGDC Per-Pixel Shading. Sim Dietrich

lecture 18 - ray tracing - environment mapping - refraction

Chapter 2 A top-down approach - How to make shaded images?

Getting fancy with texture mapping (Part 2) CS559 Spring Apr 2017

CS451Real-time Rendering Pipeline

CS 464 Review. Review of Computer Graphics for Final Exam

Lecturer Athanasios Nikolaidis

Graphics for VEs. Ruth Aylett

Last Time. Reading for Today: Graphics Pipeline. Clipping. Rasterization

Texturing Theory. Overview. All it takes is for the rendered image to look right. -Jim Blinn 11/10/2018

Surface Graphics. 200 polys 1,000 polys 15,000 polys. an empty foot. - a mesh of spline patches:

OPENGL RENDERING PIPELINE

Interpolation using scanline algorithm

Today. Rendering algorithms. Rendering algorithms. Images. Images. Rendering Algorithms. Course overview Organization Introduction to ray tracing

Lets assume each object has a defined colour. Hence our illumination model is looks unrealistic.

OpenGl Pipeline. triangles, lines, points, images. Per-vertex ops. Primitive assembly. Texturing. Rasterization. Per-fragment ops.

Announcements. Written Assignment 2 is out see the web page. Computer Graphics

Texture. Texture Mapping. Texture Mapping. CS 475 / CS 675 Computer Graphics. Lecture 11 : Texture

Computer Graphics (CS 563) Lecture 4: Advanced Computer Graphics Image Based Effects: Part 1. Prof Emmanuel Agu

Computer Graphics (CS 543) Lecture 9 (Part 2): Clipping. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

CS 475 / CS 675 Computer Graphics. Lecture 11 : Texture

The Graphics Pipeline

Problem Set 4 Part 1 CMSC 427 Distributed: Thursday, November 1, 2007 Due: Tuesday, November 20, 2007

CS559 Computer Graphics Fall 2015

Spring 2012 Final. CS184 - Foundations of Computer Graphics. University of California at Berkeley

3D Programming. 3D Programming Concepts. Outline. 3D Concepts. 3D Concepts -- Coordinate Systems. 3D Concepts Displaying 3D Models

Reflection and Shading

Computer Graphics. Lecture 14 Bump-mapping, Global Illumination (1)

CS4620/5620: Lecture 14 Pipeline

Level of Details in Computer Rendering

Transcription:

Computer Graphics (CS 543) Lecture 10: Soft Shadows (Maps and Volumes), Normal and Bump Mapping Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI)

Shadow Buffer Theory Observation: Along each path from light Only closest object is lit Other objects on that path in shadow Shadow Buffer Method Position a camera at light source. uses second depth buffer called the shadow map Shadow buffer stores closest object on each path (Stores point B) Put camera here Lit In shadow

Shadow Map Illustrated Point v a stored in element a of shadow map: lit! Point v b NOT in element b of shadow map: In shadow Not limited to planes

Shadow Map: Depth Comparison

Recall: OpenGL Depth Buffer (Z Buffer) Depth: While drawing objects, depth buffer stores distance of each polygon from viewer Why? If multiple polygons overlap a pixel, only closest one polygon is drawn Depth 1.0 1.0 1.0 1.0 1.0 0.3 0.3 1.0 0.5 0.3 0.3 1.0 0.5 0.5 1.0 1.0 eye Z = 0.5 Z = 0.3

Shadow Map Approach Rendering in two stages: Generate/load shadow Map Render the scene

Loading Shadow Map Initialize each element to 1.0 Position a camera at light source Rasterize each face in scene updating closest object Shadow map (buffer) tracks smallest depth on each path Put camera here

Shadow Map (Rendering Scene) Render scene using camera as usual While rendering a pixel find: pseudo-depth D from light source to P Index location [i][j] in shadow buffer, to be tested Value d[i][j] stored in shadow buffer If d[i][j] < D (other object on this path closer to light) point P is in shadow lighting = ambient Otherwise, not in shadow Lighting = amb + diffuse + specular D[i][j] D In shadow

Loading Shadow Map Shadow map calculation is independent of eye position In animations, shadow map loaded once If eye moves, no need for recalculation If objects move, recalculation required

Example: Hard vs Soft Shadows Hard Shadow Soft Shadow

Definitions Point light: create hard shadows (unrealistic) Area light: create soft shadows (more realistic) point source area source umbra Penumbra (some light) Umbra (no light)

Shadow Map Problems Low shadow map resolution results in jagged shadows

Percentage Closer Filtering Instead of retrieving just 1 value from shadow map, retrieve neighboring shadow map values as well Blend multiple shadow map samples to reduce jaggies

Shadow Map Result

Shadow volumes Most popular method for real time Shadow volume concept

Shadow volumes Create volumes of space in shadow from each polygon in light Each triangle creates 3 projecting quads

Using Shadow Volume To test a point, count number of polygon intersections between the point and the eye. If we look through more frontfacing than backfacing polygons, then in shadow. 1 frontfacing 1 backfacing = Not in shadow backfacing 1 frontfacing 0 backfacing = In shadow frontfacing 0 frontfacing 0 backfacing = Not in shadow

Shadow Volume Example Image courtesy of NVIDIA Inc.

Arbitrary geometry Shadow mapping and shadow volumes can render shadows onto arbitrary geometry Recent focus on shadow volumes, because currently most popular, and works on most hardware Works in real time Shadow mapping is used in Pixar s rendering software

Normal Mapping

Normal Mapping Store normals in texture Normals <x,y,z> stored in <r,g,b> values in texture Idea: Use low resolution mesh + high resolution normal map Normal map may change a lot, simulate fine details Low rendering complexity method for making low-resolution geometry look like it s much more detailed

Normal Mapping Example: Ogre OpenGL 4 Shading Language Cookbook (3rd edition) by David Wolff (pg 157) Base color texture (used this in place of diffuse component) Texture mapped Ogre (Uses mesh normals) Normal texture map Texture and normal mapped Ogre (Uses normal map to modify mesh normals)

Creating Normal Maps Many tools for creating normal map E.g. Nvidia texture tools for Adobe photoshop https://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop

Tangent Space Vectors Normals in normal map stored in object local coord. frame (or tangent space) Object Local coordinate space? Axis positioned on surface of object (NOT global x,y,z) Need Tangent, normal and bi-tangent vectors at each vertex z axis aligned with mesh normal at that point x, y axes at a tangent (and bi-tangent) to the surface

Tangent Space Vectors Normals stored in texture includes mesh transformation + local deviation (e.g. bump) Reflection model must be evaluated in object s local coordinate (n, t, b) Need to transform view, light and normal vectors into object s local coordinate space Need to transform l, v and n into object local coord. v l

Transforming V,L and N into Object s Local Coordinate Frame To transform a point P eye into a corresponding point S in object s local coordinate frame: Point S in object s local coordinate frame Point P in eye coordinate frame

Normal Mapping Example OpenGL 4 Shading Language Cookbook (3rd edition) by David Wolff (pg 159) Vertex Shader VertexPosition VertexNormal VertexTexCoord VertexTangent Vertex 1 Attributes x y z x y z s t x y z VertexPosition VertexNormal VertexTexCoord VertexTangent ayout (location) = 0 layout (location) = 1 OpenGL Program

Normal Mapping Example OpenGL 4 Shading Language Cookbook (3rd edition) by David Wolff (pg 159) Vertex Shader Transform normal and tangent to eye space. Compute bi-normal vector Form matrix to convert from eye to local object coordinates

Normal Mapping Example OpenGL 4 Shading Language Cookbook (3rd edition) by David Wolff (pg 159) Vertex Shader Get position in eye coordinates. Transform light and view directions to tangent space Fragment Shader Receive Light, View directions and TexCoord set in vertex shader Declare Normal and Color maps

Normal Mapping Example OpenGL 4 Shading Language Cookbook (3rd edition) by David Wolff (pg 159) Fragment Shader x y z x y z s t x y z r g b VertexPosition VertexNormal VertexTexCoord VertexTangent ColorTex Normal Map Diffuse Color Map

Normal Mapping Example OpenGL 4 Shading Language Cookbook (3rd edition) by David Wolff (pg 159) Fragment Shader Function to compute Phong s lighting model Look up normal from normal map Rescale from [0,1] to [-1,1] range Look up diffuse coeff. from color texture x y z x y z s t x y z r g b VertexPosition VertexNormal VertexTexCoord VertexTangent ColorTex Normal Map Diffuse Color Map