Computer Graphics Ray Casting. Matthias Teschner

Similar documents
Intersection Acceleration

Ray Tracing. Foley & Van Dam, Chapters 15 and 16

Ray Tracing Foley & Van Dam, Chapters 15 and 16

CPSC GLOBAL ILLUMINATION

Implicit Surfaces & Solid Representations COS 426

Lecture 11: Ray tracing (cont.)

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

Geometric Queries for Ray Tracing

Acceleration Data Structures

Lecture 11. More Ray Casting/Tracing

8.1 Geometric Queries for Ray Tracing

Collision Detection based on Spatial Partitioning

Ray tracing. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd 3/19/07 1

Spatial Data Structures

Sung-Eui Yoon ( 윤성의 )

Ray Tracing III. Wen-Chieh (Steve) Lin National Chiao-Tung University

Homework #2. Hidden Surfaces, Projections, Shading and Texture, Ray Tracing, and Parametric Curves

Ray casting. Ray casting/ray tracing

Ray Tracing CSCI 4239/5239 Advanced Computer Graphics Spring 2018

Solid Modeling. Ron Goldman Department of Computer Science Rice University

CS580: Ray Tracing. Sung-Eui Yoon ( 윤성의 ) Course URL:

Advanced Computer Graphics Transformations. Matthias Teschner

Simulation in Computer Graphics Space Subdivision. Matthias Teschner

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

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

1999, Denis Zorin. Ray tracing

GEOMETRIC TOOLS FOR COMPUTER GRAPHICS

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

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

CS770/870 Spring 2017 Ray Tracing Implementation

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

Ray Tracing. Cornell CS4620/5620 Fall 2012 Lecture Kavita Bala 1 (with previous instructors James/Marschner)

Spatial Data Structures

Using Bounding Volume Hierarchies Efficient Collision Detection for Several Hundreds of Objects

Motivation. Sampling and Reconstruction of Visual Appearance. Effects needed for Realism. Ray Tracing. Outline

Topics and things to know about them:

Spatial Data Structures

Accelerating Geometric Queries. Computer Graphics CMU /15-662, Fall 2016

Geometric Representations. Stelian Coros

Topics. Ray Tracing II. Intersecting transformed objects. Transforming objects

CS 465 Program 5: Ray II

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

12 m. 30 m. The Volume of a sphere is 36 cubic units. Find the length of the radius.

Effects needed for Realism. Ray Tracing. Ray Tracing: History. Outline. Foundations of Computer Graphics (Spring 2012)

Collision Detection with Bounding Volume Hierarchies

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

CPSC / Sonny Chan - University of Calgary. Collision Detection II

2. Give an example of a non-constant function f(x, y) such that the average value of f over is 0.

Logistics. CS 586/480 Computer Graphics II. Questions from Last Week? Slide Credits

Ray Tracing. CS334 Fall Daniel G. Aliaga Department of Computer Science Purdue University

Advanced Ray Tracing

CHAPTER 1 Graphics Systems and Models 3

Topics. Ray Tracing II. Transforming objects. Intersecting transformed objects

Last Time: Acceleration Data Structures for Ray Tracing. Schedule. Today. Shadows & Light Sources. Shadows

Questions from Last Week? Extra rays needed for these effects. Shadows Motivation

CS 431/636 Advanced Rendering Techniques

Ray Tracing. Kjetil Babington

Interactive Computer Graphics A TOP-DOWN APPROACH WITH SHADER-BASED OPENGL

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

COMP 175 COMPUTER GRAPHICS. Ray Casting. COMP 175: Computer Graphics April 26, Erik Anderson 09 Ray Casting

MSBVH: An Efficient Acceleration Data Structure for Ray Traced Motion Blur

Ray Tracing. Outline. Ray Tracing: History

9. Three Dimensional Object Representations

CS 4620 Midterm, March 21, 2017

Ray Tracing. Shandong University

Ray Casting. Outline in Code. Outline. Finding Ray Direction. Heckbert s Business Card Ray Tracer. Foundations of Computer Graphics (Fall 2012)

Particle systems, collision detection, and ray tracing. Computer Graphics CSE 167 Lecture 17

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

Introduction to Visualization and Computer Graphics

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

Spatial Data Structures

Homework 1: Implicit Surfaces, Collision Detection, & Volumetric Data Structures. Loop Subdivision. Loop Subdivision. Questions/Comments?

Ray Genealogy. Raytracing: Performance. Bounding Volumes. Bounding Volume. Acceleration Classification. Acceleration Classification

Spatial Data Structures

Accelerated Raytracing

Ray Casting. To Do. Outline. Outline in Code. Foundations of Computer Graphics (Spring 2012) Heckbert s Business Card Ray Tracer

Ray Tracer I: Ray Casting Due date: 12:00pm December 3, 2001

Today. Acceleration Data Structures for Ray Tracing. Cool results from Assignment 2. Last Week: Questions? Schedule

Computer Graphics and Image Processing Ray Tracing I

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

Chapter 6 Some Applications of the Integral

Bounding Volume Hierarchies

Photorealism: Ray Tracing

Programming projects. Assignment 1: Basic ray tracer. Assignment 1: Basic ray tracer. Assignment 1: Basic ray tracer. Assignment 1: Basic ray tracer

Solid Modeling. Michael Kazhdan ( /657) HB , FvDFH 12.1, 12.2, 12.6, 12.7 Marching Cubes, Lorensen et al.

From curves to surfaces. Parametric surfaces and solid modeling. Extrusions. Surfaces of revolution. So far have discussed spline curves in 2D

Ray Tracing Acceleration. CS 4620 Lecture 22

Raytracing CS148 AS3. Due :59pm PDT

Mach band effect. The Mach band effect increases the visual unpleasant representation of curved surface using flat shading.

Supplement to Lecture 16

CS 4620 Program 4: Ray II

Ray-tracing Acceleration. Acceleration Data Structures for Ray Tracing. Shadows. Shadows & Light Sources. Antialiasing Supersampling.

Ray Tracing Acceleration. CS 4620 Lecture 20

SUMMARY. CS380: Introduction to Computer Graphics Ray tracing Chapter 20. Min H. Kim KAIST School of Computing 18/05/29. Modeling

COMP 175: Computer Graphics April 11, 2018

Chapter 9. Linear algebra applications in geometry

Lesson 05. Mid Phase. Collision Detection

Computer Graphics I Lecture 11

Polygon Meshes and Implicit Surfaces

COMP 4801 Final Year Project. Ray Tracing for Computer Graphics. Final Project Report FYP Runjing Liu. Advised by. Dr. L.Y.

Transcription:

Computer Graphics Ray Casting Matthias Teschner

Outline Context Implicit surfaces Parametric surfaces Combined objects Triangles Axis-aligned boxes Iso-surfaces in grids Summary University of Freiburg Computer Science Department 2

Rendering Visibility / hidden surface problem Object projection onto sensor plane Ray-object intersections with Ray Casting Shading Phong illumination model Rendering equation [Jeremy Birn] University of Freiburg Computer Science Department 3

Ray Casting Computes ray-scene intersections to estimate projections of scene primitives onto the sensor Ray Ray Casting computes ray-scene intersections to estimate q from p. University of Freiburg Computer Science Department 4

Ray Tracing - Concept Ray 1 Ray 3 Ray 2 Ray 4 Ray 1 Outgoing light from source Incoming light at surface Direct illumination Ray 2 Outgoing light from source Incoming light at surface Direct illumination Ray 3 Outgoing light from surface Incoming light at surface Indirect illumination Ray 4 Outgoing light from surface Incoming light at sensor University of Freiburg Computer Science Department 5

Ray Tracing - Challenge Ray 4 Incoming light at the sensor Main goal of a Ray Tracer q Ray 1 Ray 2 Ray 1, 2, 3, Incoming / outgoing light at all other paths is required to compute light at ray 4 Ray 3 p Ray 4 Ray 3 Two surfaces illuminate each other. Outgoing light from q towards p depends on outgoing light from p towards q which depends on University of Freiburg Computer Science Department 6

Ray Tracing - Terms Secondary ray / shadow ray Primary rays start / end at sensors Secondary rays do not start / end at sensors Secondary ray Secondary ray / shadow ray Primary ray Shadow rays start / end at light sources University of Freiburg Computer Science Department 7

Ray Tracing and Ray Casting Primary rays solve the visibility problem What is visible at the sensor? Ray Casting Secondary rays are used to compute the light transport along a primary ray towards the viewer Which color does it have? Ray Tracing University of Freiburg Computer Science Department 8

Ray Tracing and Ray Casting Ray Casting Computation of position p. What is visible at the sensor? Position Primary ray Incoming light from direction along a secondary ray Position Ray Tracing Computation of the light that is transported along primary rays. Which color does it have? Secondary rays are used. Outgoing light into direction (primary ray) is a sum of incident light from all directions (secondary rays) weighted with material properties. University of Freiburg Computer Science Department 9

Ray Casting - Concept Ray A half-line specified by an origin / position Parametric form Nearest intersection with all objects has to be computed, i.e. intersection with minimal t 0 with and a direction [Suffern] Orthographic camera with parallel rays University of Freiburg Computer Science Department 10

Outline Context Implicit surfaces Parametric surfaces Combined objects Triangles Axis-aligned boxes Iso-surfaces in grids Summary University of Freiburg Computer Science Department 11

Implicit Surfaces Implicit functions implicitly define a set of surface points For a surface point, an implicit function is zero An intersection occurs, if a point on a ray satisfies the implicit equation E.g., all points on a plane with surface normal and offset satisfy the equation The intersection with a ray can be computed based on if d is not orthogonal to n University of Freiburg Computer Science Department 12

Implicit Surfaces - Normal Perpendicular to the surface Given by the gradient of the implicit function E.g., for a point on a plane University of Freiburg Computer Science Department 13

Implicit Surfaces Implicit surface Ray Ray-surface intersection University of Freiburg Computer Science Department 14

Quadrics E.g. Sphere Ellipsoid Paraboloid Hyperboloid Cone Cylinder Represented by quadratic equations, i.e. zero, one or two intersections with a ray [Wikipedia: Quadric] University of Freiburg Computer Science Department 15

Quadrics - Sphere At the origin with radius one Quadratic equation in t Surface normal University of Freiburg Computer Science Department 16

Quadrics - Sphere Ray 1: Ray 2: Ray 3: University of Freiburg Computer Science Department 17

Quadrics - Example [Suffern] University of Freiburg Computer Science Department 18

Outline Context Implicit surfaces Parametric surfaces Combined objects Triangles Axis-aligned boxes Iso-surfaces in grids Summary University of Freiburg Computer Science Department 19

Parametric Surfaces Are represented by functions with 2D parameters Intersection can be computed from a (non-linear) system with three equations and three unknowns Normal vector Tangent Tangent University of Freiburg Computer Science Department 20

Parametric Surfaces, e.g., Cylinder, Sphere Cylinder about z-axis with parameters and Sphere centered at the origin with parameters and Parametric representations are used to render partial objects, e.g. University of Freiburg Computer Science Department 21

Parametric Surfaces, e.g., Disk, Cone Disk with radius r at height h along the z-axis with inner radius r i with parameters u and Cone with radius r and height h and parameters u and University of Freiburg Computer Science Department 22

Outline Context Implicit surfaces Parametric surfaces Combined objects Triangles Axis-aligned boxes Iso-surfaces in grids Summary University of Freiburg Computer Science Department 23

Compound Objects Consist of components [Suffern] University of Freiburg Computer Science Department 24

Constructive Solid Geometry Combine simple objects to complex geometry using Boolean operators Difference of a cube and a sphere. Sphere intersections are only considered inside the cube. Cube intersections are not considered inside the sphere. [Wikipedia: Constructive Solid Geometry] [Wikipedia: Computergrafik] University of Freiburg Computer Science Department 25

Constructive Solid Geometry Closed surfaces / defined volumes required A A A B B B Union Intersection Difference B-A University of Freiburg Computer Science Department 26

Implementation Estimate and analyze all intersections Consider intervals inside objects Works for closed surfaces Union Closest intersection Intersection Closest intersection with A inside B or closest intersection with B inside A Difference University of Freiburg Computer Science Department 27 B A

Outline Context Implicit surfaces Parametric surfaces Combined objects Triangles Axis-aligned boxes Iso-surfaces in grids Summary University of Freiburg Computer Science Department 28

Triangle Meshes Popular approximate surface representation Surface vertices connected to faces [Wikipedia: Stanford bunny] University of Freiburg Computer Science Department 29

Triangles Parametric representation (Barycentric coordinates) Vertices p 0, p 1, p 2 form a triangle. p is an arbitrary point in the plane of the triangle. University of Freiburg Computer Science Department 30

Barycentric Coordinates - Properties Point corresponds to a triangle vertex Point located on a triangle edge Point located inside triangle Point located outside triangle University of Freiburg Computer Science Department 31

Triangles Potential intersection point is on the ray and in the triangle plane Point on the ray Point in the triangle plane (not necessarily inside the triangle) University of Freiburg Computer Science Department 32

Triangles - Intersection Solution Non-degenerated triangle and ray not parallel to triangle plane: Intersection inside triangle: Intersection in front of sensor: Triple product. Volume of a parallelepiped. University of Freiburg Computer Science Department 33

Outline Context Implicit surfaces Parametric surfaces Combined objects Triangles Axis-aligned boxes Iso-surfaces in grids Summary University of Freiburg Computer Science Department 34

Motivation Simple geometry with an efficient intersection test encloses a complex geometry Rays that miss the simple geometry are not tested against the complex geometry Complex geometry Simple geometry University of Freiburg Computer Science Department 35

Axis-Aligned Bounding Box (AABB) Characteristics Aligned with the principal coordinate axes Simple representation (an interval per axis) Efficient intersection test Can be translated with object Update required for other transformations Alternatives Object-oriented boxes, k-dops, spheres University of Freiburg Computer Science Department 36

AABB Boxes are represented by slabs Intersections of rays with slabs are analyzed to check for ray-box intersection E.g. non-overlapping ray intervals within different slabs indicate that the ray misses the box [Suffern] University of Freiburg Computer Science Department 37

AABB Intersection Test Ray-plane intersection [Suffern] Intersection with x-slab Intersection with y-slab University of Freiburg Computer Science Department 38

AABB Intersection Test Overlapping ray intervals inside an AABB indicate intersections [Suffern] University of Freiburg Computer Science Department 39

Bounding Volume Hierarchies (BVH) AABBs can be combined to hierarchies AABB AABB AABB Object primitives University of Freiburg Computer Science Department 40

BVH Intersection Test Traversing the BVH If a box is intersected, test its children log n box tests for an object with n faces Efficient pruning of irrelevant regions Memory and preprocessing overhead University of Freiburg Computer Science Department 41

Outline Context Implicit surfaces Parametric surfaces Combined objects Triangles Axis-aligned boxes Iso-surfaces in grids Summary University of Freiburg Computer Science Department 42

Motivation Ray casting of fluid surfaces Fluid particles Ray-surface intersection without explicit surface representation University of Freiburg Computer Science Department 43

Density Mapping onto Grid Fluid particles with densities Density interpolation at grid cells, e.g. University of Freiburg Computer Science Department 44

Density Interpolation in a Grid Cell Trilinear interpolation of scalar values inside a grid cell [Parker et al.] University of Freiburg Computer Science Department 45

Ray-Isosurface Intersection Define an iso-value Ray Compute with and University of Freiburg Computer Science Department 46

Intersection Normal Gradient of the density field Approximated, e.g., with finite differences University of Freiburg Computer Science Department 47

Outline Context Implicit surfaces Parametric surfaces Combined objects Triangles Axis-aligned boxes Iso-surfaces in grids Summary University of Freiburg Computer Science Department 48

Ray Casting Very versatile concept to compute what is visible at a sensor Implicit surfaces, parametric surfaces Expensive for complex geometries Spatial data structures, e.g. bounding volume hierarchies Can be simple Linear or quadratic formulations (plane, triangle, sphere) Can be involved Non-linear parametric surfaces, iso-surfaces University of Freiburg Computer Science Department 49