COMPUTER GRAPHICS AND INTERACTION

Similar documents
RAYTRACING. Christopher Peters INTRODUCTION TO COMPUTER GRAPHICS AND INTERACTION. HPCViz, KTH Royal Institute of Technology, Sweden

GLOBAL ILLUMINATION. Christopher Peters INTRODUCTION TO COMPUTER GRAPHICS AND INTERACTION

LIGHTING AND SHADING

COMP371 COMPUTER GRAPHICS

Ray Tracing. CSCI 420 Computer Graphics Lecture 15. Ray Casting Shadow Rays Reflection and Transmission [Ch ]

Rendering Part I (Basics & Ray tracing) Lecture 25 December 1, 2015

RASTERISED RENDERING

Lighting. To do. Course Outline. This Lecture. Continue to work on ray programming assignment Start thinking about final project

Shading, Advanced Rendering. Week 7, Wed Feb 28

Raytracing CS148 AS3. Due :59pm PDT

CPSC GLOBAL ILLUMINATION

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

Global Illumination. CSCI 420 Computer Graphics Lecture 18. BRDFs Raytracing and Radiosity Subsurface Scattering Photon Mapping [Ch

Global Rendering. Ingela Nyström 1. Effects needed for realism. The Rendering Equation. Local vs global rendering. Light-material interaction

Rendering: Reality. Eye acts as pinhole camera. Photons from light hit objects

Photorealism: Ray Tracing

Global Illumination. Global Illumination. Direct Illumination vs. Global Illumination. Indirect Illumination. Soft Shadows.

CS354 Computer Graphics Ray Tracing. Qixing Huang Januray 24th 2017

Global Illumination. Global Illumination. Direct Illumination vs. Global Illumination. Indirect Illumination. Soft Shadows.

Consider a partially transparent object that is illuminated with two lights, one visible from each side of the object. Start with a ray from the eye

Global Illumination. Why Global Illumination. Pros/Cons and Applications. What s Global Illumination

Lighting and Shading Computer Graphics I Lecture 7. Light Sources Phong Illumination Model Normal Vectors [Angel, Ch

Topic 12: Texture Mapping. Motivation Sources of texture Texture coordinates Bump mapping, mip-mapping & env mapping

Topic 11: Texture Mapping 11/13/2017. Texture sources: Solid textures. Texture sources: Synthesized

Lighting and Shading

Computer Graphics. Lecture 13. Global Illumination 1: Ray Tracing and Radiosity. Taku Komura

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

Topic 11: Texture Mapping 10/21/2015. Photographs. Solid textures. Procedural

Virtual Reality for Human Computer Interaction

DH2323 DGI13. Lab 2 Raytracing

Lecture 15: Shading-I. CITS3003 Graphics & Animation

MITOCW MIT6_172_F10_lec18_300k-mp4

Raytracing. Flat shading Phong Shading. COSC 4328/5327 Scott A. King

Comp 410/510 Computer Graphics. Spring Shading

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

Raytracing. COSC 4328/5327 Scott A. King

Intro to Ray-Tracing & Ray-Surface Acceleration

Ray Tracer Due date: April 27, 2011

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

Global Illumination. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

Introduction to Visualization and Computer Graphics

Computer Graphics. Lecture 10. Global Illumination 1: Ray Tracing and Radiosity. Taku Komura 12/03/15

CS5620 Intro to Computer Graphics

PHY 171 Lecture 6 (January 18, 2012)

Local Illumination. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

The Rendering Equation. Computer Graphics CMU /15-662

Assignment 2 Ray Tracing

Global Illumination. COMP 575/770 Spring 2013

Topics and things to know about them:

782 Schedule & Notes

Assignment 6: Ray Tracing

Ray Tracing. Local Illumination. Object Space: Global Illumination. Image Space: Backward Ray Tracing. First idea: Forward Ray Tracing

A Little Background. Motivation. Motivation

INFOGR Computer Graphics. J. Bikker - April-July Lecture 10: Ground Truth. Welcome!

Lighting affects appearance

Lecture 18: Primer on Ray Tracing Techniques

Last Time? Ray Casting. Administrivia: Lab & Office Hours. Notes on Assignments. Ray Casting. Overview of Today

A Brief Overview of. Global Illumination. Thomas Larsson, Afshin Ameri Mälardalen University

CS130 : Computer Graphics Lecture 8: Lighting and Shading. Tamar Shinar Computer Science & Engineering UC Riverside

CS 4204 Computer Graphics

INTRODUCTION COMPUTER GRAPHICS AND INTERACTION. Christopher Peters. CST, KTH Royal Institute of Technology, Sweden

Ray Tracing Basics I. Computer Graphics as Virtual Photography. camera (captures light) real scene. photo. Photographic print. Photography: processing

CS 325 Computer Graphics

Simple Lighting/Illumination Models

Computer Graphics Tick 1

COMPLETION OF Z-buffer Graphics Pipeline

Global Illumination CS334. Daniel G. Aliaga Department of Computer Science Purdue University

Lighting. Figure 10.1

So far, we have considered only local models of illumination; they only account for incident light coming directly from the light sources.

Movie: For The Birds. Announcements. Ray Tracing 1. Programming 2 Recap. Programming 3 Info Test data for part 1 (Lines) is available

Lecture 17: Recursive Ray Tracing. Where is the way where light dwelleth? Job 38:19

Shading I Computer Graphics I, Fall 2008

Recall: Basic Ray Tracer

Computer Graphics Global Illumination

Illumination & Shading: Part 1

Introduction Ray tracing basics Advanced topics (shading) Advanced topics (geometry) Graphics 2010/2011, 4th quarter. Lecture 11: Ray tracing

Ray tracing Tutorial. Lukas Herzberger

Practical Techniques for Ray Tracing in Games. Gareth Morgan (Imagination Technologies) Aras Pranckevičius (Unity Technologies) March, 2014

CS 465 Program 5: Ray II

Module 5: Video Modeling Lecture 28: Illumination model. The Lecture Contains: Diffuse and Specular Reflection. Objectives_template

Topic 9: Lighting & Reflection models 9/10/2016. Spot the differences. Terminology. Two Components of Illumination. Ambient Light Source

Raytracing & Epsilon. Today. Last Time? Forward Ray Tracing. Does Ray Tracing Simulate Physics? Local Illumination

Topic 9: Lighting & Reflection models. Lighting & reflection The Phong reflection model diffuse component ambient component specular component

Ray Tracing I. Internet Raytracing Competition

COMP 175 COMPUTER GRAPHICS. Lecture 11: Recursive Ray Tracer. COMP 175: Computer Graphics April 9, Erik Anderson 11 Recursive Ray Tracer

03 RENDERING PART TWO

Computer Graphics Global Illumination

The Rendering Equation and Path Tracing

Illumination. The slides combine material from Andy van Dam, Spike Hughes, Travis Webb and Lyn Fong

Chapter 9- Ray-Tracing

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

Lecture 32 of 41. Lab 6: Ray Tracing with ACM SIGGRAPH Demo & POV-Ray

6. Illumination, Lighting

Chapter 11 Global Illumination. Part 1 Ray Tracing. Reading: Angel s Interactive Computer Graphics (6 th ed.) Sections 11.1, 11.2, 11.

Ray Tracing. Brian Curless CSEP 557 Fall 2016

I have a meeting with Peter Lee and Bob Cosgrove on Wednesday to discuss the future of the cluster. Computer Graphics

Ray-Tracing. Misha Kazhdan

Introduction to Computer Graphics 7. Shading

Lecture Outline Chapter 26. Physics, 4 th Edition James S. Walker. Copyright 2010 Pearson Education, Inc.

CS452/552; EE465/505. Intro to Lighting

Transcription:

DH2323 DGI17 COMPUTER GRAPHICS AND INTERACTION INTRODUCTION TO RAYTRACING Christopher Peters CST, KTH Royal Institute of Technology, Sweden chpeters@kth.se http://kth.academia.edu/christopheredwardpeters

Image Synthesis In computer graphics, create images based on a model Recall: An underlying process generates observations Can control generation through parameters

Nice Results "Pebbles" by Jonathan Hunt "Bonsai Life" by Jeremy M. Praay "Glasses" by Gilles Tran

Nice Results "Distant Shores" by Christoph Gerber "Christmas Baubles" by Jaime Vives Piqueres "Still with Bolts" by Jaime Vives Piqueres

Geometry Some Constituents I 2017

Geometric primitives (a brief introduction) 2017

Triangle meshes 2015 Arma3, Bohemia Interactive

Point clouds 2015 Arma3, Bohemia Interactive

Some Constituents I Geometry Lighting Surface properties Anything else? 2017

A Camera! Camera Model (pinhole)

Master of your own (virtual) Universe You determine the physical laws (and models) that define your virtual world and simulate it How is the transportation of light simulated? Does gravity affect the environment? Can solid objects, such as people, move through each other / the environment? Should a ball bounce when it hits the ground and how should it deform? How do fluids act? In what cases do objects float? How do nebulae disperse and galaxies interact? 2015

Master of your own (virtual) Universe I-Novae Engine, I-Novae Studios 2015

Master of your own (virtual) Universe You determine the physical laws (and models) that define your virtual world and simulate it How is the transportation of light simulated? Does gravity affect the environment? Can solid objects, such as people, move through each other / the environment? Should a ball bounce when it hits the ground and how should it deform? How do fluids act? In what cases do objects float? How do nebulae disperse and galaxies interact? But there's a catch... 2015

The catch These laws do not exist in the virtual world by default Must computationally model and program them 2015

Idea 1 Use the concept of light rays for modelling transport of light Define light sources that emit rays Test for intersections between rays and geometric shapes in the scene When a ray hits the surface of a shape See how much light energy bounces i.e. is reflected When a ray hits the image plane of the camera Render a colour to the screen

Question How do we go from this idea to a computational model? i.e. how to define an algorithm or step-by-step procedure

Answer: Remember this? Interactive computer graphics is essentially: Mathematics programming Quite possibly the most fun and rewarding maths programming you will ever do* *disclaimer: you'll get from it what you put in

Maths Programming Toolkit Define a toolkit of mathematical operations Each will be important for our final algorithm Important keywords from idea 1: Light rays from light sources Intersections with geometry Bounces/reflects off surfaces Render to screen

What is a 'Light Ray'? Concept Idealised narrow beam of light (optics) Discrete, particles Geometrically speaking: Similar in some ways to a straight line Has a starting point and direction But extends infinitely in defined direction Mathematically:

Where do they come from? Emitted from light sources Parameterised Position Colour Intensity Light Source

Intersections Need to be able to test for intersections between rays and scene geometry (objects) Different types of geometry: Planes Spheres Triangles Resolving intersections involve solving equations

Ray-plane Intersection Plane defined as: Intersection point:

Ray-sphere Intersection Sphere defined as: Intersections:

Worked Example (recommend to work this out later using a pen and paper) Find the intersections, if any, between the Ray with r 0 = (0,2,0) T, r d = (0,-1,0) T and the Sphere with x c = (0,0,0) T, r = 1 Apply the quadratic formula t = -b +/- sqrt(b 2-4ac)/(2a) to find two solutions, where: a = r d.r d b = 2r d.(r 0 -x c ) c = (r 0 -x c ).(r 0 -x c )-r 2 The value of b 2-4ac indicates how many roots the equation has, where negative number indicates no intersections between the ray and sphere, a zero indicates a single intersection on the edge of the sphere and a positive number indicates two intersections where the ray enters and exits the sphere. In this example, b 2-4ac is positive indicating two intersections. Apply formula; r d.r d t 2 +2r d.(r 0 -x c )t+(r 0 -x c ).(r 0 -x c )-r 2 =0 Entering the above value gives t 2-4t+3=0 => t = 3 and t = 1 Recalling ray equation: r 0 +t.r d t=1: (0,2,0)+(0,-1,0) = (0,1,0) first intersection point t=3: (0,2,0)+(0,-3,0) = (0,-1,0) second intersection point

Ray-triangle Intersection Triangle defined as:

Ray-triangle Intersection Triangle defined as: Intersection:

Surfaces Must also consider rays hitting and bouncing off surfaces

Surfaces Must also consider rays hitting and bouncing off surfaces Surface types can reflect/refract rays in different ways

Accurate Reflection Complex opaque surfaces scatter incoming light in many different directions

Accurate Reflection Complex opaque surfaces scatter incoming light in many different directions Where does this information come from?

Surfaces Specular surfaces are like mirrors Light from a single incoming direction reflected into a single outgoing direction

Surfaces Diffuse (matte) surfaces are more rough Light from a single incoming direction reflected in multitude of outgoing directions Lambertian surface

Modelling Specular Surfaces Incoming ray P, outgoing ray Q and face normal are in the same plane Angle from normal the same between incoming and outgoing ray Rays P and Q are on opposite sides of the face normal

Modelling Diffuse Surfaces Lambertian reflection Surface is equally bright independent of viewing angle Isotropic uniform in all directions

Modelling Refraction

Some Light Types Ambient Lighting Constant light affecting each part of the scene equally Point Light Sources Rays travelling from a point in all directions Spotlight Sources Rays travelling from a point in limited directions

Our Initial Idea We have now defined some modelling elements Remember our initial idea:

Is this feasible?? Question

Question Is this feasible?? Think of what the procedure may look like:

Idea 2 Cast rays of light backwards through the viewing plane, into the scene Test for intersections between each ray and virtual objects in the scene

Idea 2 Cast rays of light backwards through the viewing plane, into the scene Test for intersections between each ray and virtual objects in the scene Ray fails to hit anything Background or default colour returned

Idea 2 Cast rays of light backwards through the viewing plane, into the scene Test for intersections between each ray and virtual objects in the scene Ray fails to hit anything Background or default colour returned When ray hits (i.e. 'intersects') first object Cast ray from intersection point on object to light sources Test material properties of object

Backwards Raytracing

Termination Criteria 1. No intersection

Termination Criteria 1. No intersection 2. Reach maximal depth Number of bounces

Termination Criteria 1. No intersection 2. Reach maximal depth Number of bounces 3. Contribution of secondary ray attenuated below threshold Each reflection/refraction bounce attenuates ray

Shadows

Raytracing in General Simple algorithm Capable of simulating complex light interactions Well-suited for software rendering Very flexible Easy to incorporate new effects Not always viewed as so interactive But things are changing Quake Wars: Ray-traced

Overall One of a number of global illumination models Global illumination More realism More computation Others include: 1. Radiosity 2. Photon mapping 3. Path tracing 4. Ambient occlusion Museum scene with radiosity Battlefield 3 radiosity

Next lecture More details about projects Next Monday (3 rd April) 10:00 12:00 D2 Labs: Download and start to look at the first lab You are doing well at this stage if you have a basic version building The C++ tutorial and introduction lab session may run again (according to demand) 2017