COMPLETION OF Z-buffer Graphics Pipeline

Similar documents
CS 4204 Computer Graphics

COMP371 COMPUTER GRAPHICS

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

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

Recursion and Data Structures in Computer Graphics. Ray Tracing

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

CPSC GLOBAL ILLUMINATION

Computer Graphics and Image Processing Ray Tracing I

Lecture 18: Primer on Ray Tracing Techniques

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

Recursive Ray Tracing. Ron Goldman Department of Computer Science Rice University

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

Computer Graphics. Si Lu. Fall uter_graphics.htm 11/22/2017

Local Illumination physics. Law of reflection and Snell s law of refraction

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

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

Ray-Tracing. Misha Kazhdan

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

Review for Ray-tracing Algorithm and Hardware

Announcements. Written Assignment 2 out (due March 8) Computer Graphics

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

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

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

Shading, Advanced Rendering. Week 7, Wed Feb 28

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

Raytracing. COSC 4328/5327 Scott A. King

Computer Graphics. Lecture 9 Environment mapping, Mirroring

Computer Graphics. Ray Tracing. Based on slides by Dianna Xu, Bryn Mawr College

Photorealism: Ray Tracing

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

Photorealism. Photorealism: Ray Tracing. Ray Tracing

Supplement to Lecture 16

1999, Denis Zorin. Ray tracing

Assignment 6: Ray Tracing

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

Ray Tracing Part 1. CSC418/2504 Introduction to Computer Graphics. TA: Muhammed Anwar & Kevin Gibson

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

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

Ray Casting. Outline. Similar to glulookat derivation. Foundations of Computer Graphics

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

Lecture 8 Ray tracing Part 1: Basic concept Yong-Jin Liu.

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

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

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

Ray Tracing. Outline. Ray Tracing: History

Sung-Eui Yoon ( 윤성의 )

The Traditional Graphics Pipeline

3D Polygon Rendering. Many applications use rendering of 3D polygons with direct illumination

Ray Tracing. Kjetil Babington

COMP30019 Graphics and Interaction Ray Tracing

Effects needed for Realism. Computer Graphics (Fall 2008) Ray Tracing. Ray Tracing: History. Outline

Ray tracing. EECS 487 March 19,

COMPUTER GRAPHICS AND INTERACTION

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

The Traditional Graphics Pipeline

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

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

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

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

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

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

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

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

CS 488. More Shading and Illumination. Luc RENAMBOT

Werner Purgathofer

Computer Graphics. Bing-Yu Chen National Taiwan University The University of Tokyo

Ray Tracing I. Internet Raytracing Competition

The Traditional Graphics Pipeline

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

Intro to Ray-Tracing & Ray-Surface Acceleration

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

Lecture 11: Ray tracing (cont.)

Raytracing CS148 AS3. Due :59pm PDT

CS 428: Fall Introduction to. Raytracing. Andrew Nealen, Rutgers, /18/2009 1

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

CS Computer Graphics: Introduction to Ray Tracing

CS Computer Graphics: Introduction to Ray Tracing

COMP environment mapping Mar. 12, r = 2n(n v) v

Virtual Reality for Human Computer Interaction

DH2323 DGI13. Lab 2 Raytracing

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Pipeline Operations. CS 4620 Lecture 10

Computer Graphics. Bing-Yu Chen National Taiwan University

Ray Tracing. Computer Graphics CMU /15-662, Fall 2016

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Luxo Jr. (Pixar, 1986) Last Time. Real Cameras and Ray Tracing. Standard Rasterization. Lights, Cameras, Surfaces. Now Playing:

Computer Graphics 10 - Shadows

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

Photorealistic 3D Rendering for VW in Mobile Devices

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

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

Models and Architectures

Hidden Surface Elimination Raytracing. Pre-lecture business. Outline for today. Review Quiz. Image-Space vs. Object-Space

CS3500 Computer Graphics Module: Lighting and Shading

Rasterization Overview

Ray tracing. Methods of Programming DV2. Introduction to ray tracing and XML. Forward ray tracing. The image plane. Backward ray tracing

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

MITOCW MIT6_172_F10_lec18_300k-mp4

03 RENDERING PART TWO

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

Transcription:

Z-buffer algorithm for each polygon in model project vertices of polygon onto viewing plane for each pixel inside the projected polygon calculate pixel colour calculate pixel z-value compare pixel z-value to value stored for pixel in z-buffer if pixel is closer, draw it in frame-buffer and z-buffer end end

COMPLETION OF Z-buffer Graphics Pipeline OCS WCS VCS CCS Modeling transformation Viewing transformation Projection transformation Rasterization DCS Viewport transformation NDCS Perspective division

Raytracing Rendered by PovRay 3.6 www.povray.org

Raytracing Tuned for specular and transparent objects Partly physics, geometric, optics A pixel should have the color of the object point that projects to it.

Raytracing for each pixel on screen determine ray from eye through pixel find closest intersection of ray with an object cast off reflected and refracted ray, recursively calculate pixel colour, draw pixel end

Forward and Backward methods Forward: from light sources to eye eye Backward: from eye to light sources eye

Scene S A shiny, transparent S B,S D diffuse, opaque S C shiny, opaque S C Light S D Eye S A S B

Three sources of light The light that point P A emits to the eye comes from: light sources other objects (reflection) other objects (refraction) S C Light S D Eye P A S A S B,S D shiny, transparent diffuse,opaque S A S C shiny, opaque S B

Directly from light source Local illumination model: I = Ia+Idiff+Ispec S A S B,S D S C shiny, transparent diffuse,opaque shiny, opaque Light S C S D Eye S A S B

Reflection What is the color that is reflected to P A and that PA reflects back to the eye? The color of P C. What is the color of P C? S A S B,S D S C shiny, transparent diffuse,opaque shiny, opaque Light S C S D Eye Pc n S A S B

Reflection What is the color of Pc? Just like P A : raytrace P C i.e compute the three contributions from Light sources Reflection Refraction Eye S A S B,S D S C S C shiny, transparent diffuse,opaque shiny, opaque Light Pc S D S A S B

Refraction Transparent materials How do you compute the refracted contribution? You raytrace the refracted ray. 1. Lights 2. Reflection 3. Refraction Eye S A S B,S D S C S C shiny, transparent diffuse,opaque shiny, opaque Light S D S A S B

What are we missing?

What are we missing? Diffuse objects do not receive light from other objects.

Three sources of light together The color that the pixel is assigned comes from: light sources other objects (reflection) other objects (refraction) Eye S A S B,S D S C S C shiny, transparent diffuse,opaque shiny, opaque Light S D It is more convenient to trace the rays from the eye to the scene (backwards) S A S B

Backwards Raytracing Algoritm For each pixel construct a ray: eye pixel raytrace( ray ) P = compute_closest_intersection(ray) color_local = ShadowRay(light1, P)+ + ShadowRay(lightN, P) color_reflect = raytrace(reflected_ray ) color_refract = raytrace(refracted_ray ) color = color_local + k re *color_reflect return( color ) + k ra *color_refract

How many levels of recursion do we use? The more the better. Infinite reflections at the limit.

Stages of raytracing Setting the camera and the image plane Computing a ray from the eye to every pixel and trace it in the scene Object-ray intersections Shadow, reflected and refracted ray at each intersection

Setting up the camera

Image parameters Width 2W, Height 2H Number of pixels ncols x nrows Camera coordinate system (eye, u,v,n) Image plane at -N

Pixel coordinates in camera coordinate system Lower left corner of pixel P(r,c) has coordinates in camera space:

Lower left corner Ray through pixel: Ray through pixel Camera coordinates : P (r, c) = (u c, v r, N) W olrd coordinates : P (r, c) = eye Nn + u c u + u r v ray(r, c, t) = eye + t(p (r, c) eye) 2c ray(r, c, t) = eye + t( Nn + W ( ncols 1)u + H( 2r nrows 1)v

Ray-object intersections Unit sphere at origin - ray intersection: That s a quadratic equation

Solving a quadratic equation

First intersection? Intersections t= Ray(t) t=0

First intersection? t1 < t2 Intersections t= Ray(t) t=0

Transformed primitives? That was a canonical sphere. Where does S+ct hit the transformed sphere G = T(F)?

Linear transformation

Linear transformation

Final Intersection Inverse transformed ray Drop 1 and O to get S +c t. So..for each object Inverse transform ray and get S +c t. Find the intersection t, t h, between inv-ray and canonical sphere. Use t h in the untransformed ray S+ct to find the intersection.

Shadow ray For each light intersect shadow ray with all objects. If no intersection is found apply local illumination at intersection. If in shadow no contribution. Lights

Reflected ray Raytrace the reflected ray Ray rf (t) N a a Ray(t) P

Refracted ray Raytrace the refracted ray Snell s law N

Add all together color(r,c) = color_shadow_ray + Kre*colorre + Kra*colorra

Efficiency issues Computationally expensive avoid intersection calculations Voxel grids BSP trees Octrees Bounding volume trees optimize intersection calculations try recent hit first reuse info from numerical methods

Summary: Raytracing Recursive algorithm Function Main for each pixel (c,r) on screen determine ray r c,r from eye through pixel ray.setdepth(1) color(c,r) = raytrace(r c,r ) end for end function raytrace(r) if (ray.depth() > MAX_DEPTH) return black P = closest intersection of ray with all objects if( no intersection ) return backgroundcolor clocal = Sum(shadowRays(P,Lighti)) c re = raytrace(r re ) end c ra = raytrace(r ra ) return c = clocal+k re *c re +k ra *c ra

Advanced concepts Participating media Transculency Sub-surface scattering (e.g. Human skin) Photon mapping

Raytracing summary View dependent Computationally expensive Good for refraction and reflection effects