RAY TRACER. Winter 2013 Help Slides

Similar documents
Ray Tracer. Spring 2017 Help Session

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

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

Lecture 18: Primer on Ray Tracing Techniques

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

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

Practical 2: Ray Tracing

Ray tracing. EECS 487 March 19,

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

COMP371 COMPUTER GRAPHICS

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

CS Simple Raytracer for students new to Rendering

Lighting and Shading

CS 465 Program 5: Ray II

Assignment 6: Ray Tracing

CS 4620 Program 4: Ray II

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

CS 184: Assignment 4 Simple Raytracer

Review. Stephen J. Guy

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

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

Ray Tracer Due date: April 27, 2011

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

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

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

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

Raytracing CS148 AS3. Due :59pm PDT

Lecture 10: Ray tracing

CS-184: Computer Graphics. Administrative

Introduction to Visualization and Computer Graphics

Photon Mapping. Due: 3/24/05, 11:59 PM

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

Complex Shading Algorithms

MITOCW MIT6_172_F10_lec18_300k-mp4

Sung-Eui Yoon ( 윤성의 )

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

Global Illumination. COMP 575/770 Spring 2013

6.837 Introduction to Computer Graphics Assignment 5: OpenGL and Solid Textures Due Wednesday October 22, 2003 at 11:59pm

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

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

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

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

Schedule. MIT Monte-Carlo Ray Tracing. Radiosity. Review of last week? Limitations of radiosity. Radiosity

Intro to Ray-Tracing & Ray-Surface Acceleration

Ray Tracing. Brian Curless CSEP 557 Fall 2016

CS 325 Computer Graphics

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

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

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

Project 3 Path Tracing

MIT Monte-Carlo Ray Tracing. MIT EECS 6.837, Cutler and Durand 1

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

COMPUTER GRAPHICS AND INTERACTION

Local vs. Global Illumination & Radiosity

EDAN30 Photorealistic Computer Graphics. Seminar 1, Whitted Ray Tracing (And then some!) Magnus Andersson, PhD student

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

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

03 RENDERING PART TWO

Lecture 11. More Ray Casting/Tracing

Specular reflection. Lighting II. Snell s Law. Refraction at boundary of media

Ray Tracing. Kjetil Babington

Visual cues to 3D geometry. Light Reflection and Advanced Shading. Shading. Recognizing materials. size (perspective) occlusion shading

Shading, Advanced Rendering. Week 7, Wed Feb 28

Turn your movie file into the homework folder on the server called Lights, Camera, Action.

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

Global Illumination The Game of Light Transport. Jian Huang

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

CS 4620 Program 3: Pipeline

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

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

Deferred Rendering Due: Wednesday November 15 at 10pm

Ray Tracing. Last Time? Reading for Today. Reading for Today

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

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

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

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

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

Rendering and Radiosity. Introduction to Design Media Lecture 4 John Lee

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

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

Ray tracing Tutorial. Lukas Herzberger

TDA361/DIT220 Computer Graphics, January 15 th 2016

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

Pipeline Operations. CS 4620 Lecture 10

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

Simple Nested Dielectrics in Ray Traced Images

Advanced Ray Tracing

Photorealism: Ray Tracing

INFOGR Computer Graphics

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

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

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

CMSC427 Final Practice v2 Fall 2017

The V-Ray installer will automatically remove any previous installations. This will allow you to seamlessly upgrade from previous versions.

0. Introduction: What is Computer Graphics? 1. Basics of scan conversion (line drawing) 2. Representing 2D curves

Computer Graphics Ray Casting. Matthias Teschner

Lecture 7 - Path Tracing

Theoretically Perfect Sensor

CS 431/636 Advanced Rendering Techniques

Anti-aliasing and Monte Carlo Path Tracing. Brian Curless CSE 457 Autumn 2017

Transcription:

RAY TRACER Winter 2013 Help Slides

OUTLINE What do you have to do for this project? Ray Class Isect Class Requirements Tricks Artifact Requirement Bells and Whistles

WELCOME TO THE RAYTRACER PROJECT You have to implement: Shading (has multiple parts) Reflection and Refraction Sphere Intersection The ability to intersect triangles Complex objects consist of a 3D mesh made up of many triangles

RAY CLASS Start position r.at(t) A 3D ray is a fundamental component of a raytracer. ray r (start position, direction, RayType) enum RayType{VISIBILITY, REFLECTION, REFRACTION, SHADOW}; example: ray r(foo, bar, ray::shadow); r.at(t), returns the position end point of the ray r t: the distance from the start position

VEC.H, MAT.H: MATH FUNCTIONS vec.h gives useful tools for 2D, 3D, and 4D vectors: Easy Vector Construction eg. Vec3d x = Vec3d(0,0,0); Basic operators are overrided +,-,arithmetic, Vec3d v3 = v1 + v2 *, multiply by constant, Vec3d v3 = 2*v1; *, dotproduct, eg. double dot = v1 * v2; ^, crossproduct, eg. Vec3d cross = v1 ^ v2; Other useful functionality, read vec.h for complete details normalize(), length(), iszero()

ISECT CLASS An isect represents the location where a ray intersects an object. Important member variables: const SceneObject *obj; // the object that was intersected. double t; // the distance along the ray where it occurred. Vec3d N; // the normal to the surface where it occurred Vec2d uvcoordinates; // texture coordinates on the surface. [1.0,1.0] Material *material; // non-null if exists a unique material for this intersect. const Material &getmaterial() const; // return the material to use

REQUIREMENT: SPHERE INTERSECTION Fill in Sphere::intersectLocal in SceneObjects\Sphere.cpp: Return true if ray r intersects the canonical sphere (sphere centered at the origin with radius 1.0) in positive time. Set the values of isect i: i.obj = this i.sett(time of intersection) i.setn(normal at intersection).

REQUIREMENT: TRIANGLE INTERSECTION Fill in TrimeshFace::intersectLocal in SceneObjects\trimesh.cpp: Intersect r with the triangle abc: Vec3d &a = parent->vertices[ ids [0] ]; Vec3d &b = parent->vertices[ ids [1] ]; Vec3d &c = parent->vertices[ ids [2] ]; return true if ray r intersects the triangle. More Help? See page linked to on project website https://www.cs.washington.edu/education/courses/csep557/ handouts/triangle_intersection.pdf

REQUIREMENT: BLINN-PHONG SPECULAR-REFLECTION MODEL Fill in Material::shade in material.cpp: Refer to the RayTracing lecture: https://www.cs.washington.edu/education/courses/csep557/handouts/r aytracing.pdf To sum over the light sources, use an iterator as described in the comments of the code. Need to implement Phong normal interpolation

REQUIREMENT: MULTIPLE LIGHT SOURCES Fill in PointLight::distanceAttenuation in light.cpp (DirectionalLight::distanceAttenuation is done for you). Use the alternative described in the ray-tracing lecture where a = constantterm b = linearterm c = quadraticterm These terms are defined in light.h.

REQUIREMENT: SHADOW ATTENUATION Fill in DirectionalLight::shadowAttenuation and PointLight::shadowAttenuation in light.cpp. The ray-tracing lecture shows you where to insert this factor into the Blinn-Phong equation (A shadow for each light). Rather than simply setting the attenuation to 0 if an object blocks the light, accumulate the product of k_t s for objects which block the light (use the prod function from the vec.h). Extra Credit: Better shadow handling (caustics, global illumination, etc.)

REQUIREMENT: REFLECTION Modify RayTracer::traceRay in RayTracer.cpp to implement recursive ray tracing which takes into account reflected rays. See lecture notes.

REQUIREMENT: REFRACTION Modify RayTracer::traceRay in RayTracer.cpp create refracted rays. Remember Snell s law, be careful about total internal refraction and the normal direction when the ray is exiting a material into air You can test with simple/cube_transparent.ray Unlike reflection, this routine has several cases to consider: an incoming ray an outgoing ray totally internally refracted ray. 1 n glass =1.5 2 n air =1.0003 2 1

TIPS Use the sign of the dot product r.getdirection() with i.n to determine whether you re entering or exiting an object Use RAY_EPSILON (which is defined as 0.00001) to account for computer precision error when checking for intersections RAY_EPSILON

THE DEBUGGER TOOL shipped with the skeleton code http://www.cs.washington.edu/education/courses/csep557/13wi/project s/trace/extra/debug.html

ARTIFACT REQUIREMENT Draw a pretty picture! One JPEG/PNG image traced with your Ray Tracer submitted for voting. Has to be a (somewhat) original scene For each image submitted for voting, a short.txt description of the scene or special features. Examples of each bell/whistle implemented with an accompanying readme.txt specifying which image demonstrates which feature (and where/how).

RAY TRACING YOUR SURFACE OF REVOLUTION Render your surface of revolution to earn one easy extra point Using this code snippet to write triangle mesh into a file http://www.cs.washington.edu/education/courses/csep557/13 wi/projects/trace/code/write_revolution_rayfile.c Using this.ray file as a template http://www.cs.washington.edu/education/courses/csep557/13 wi/projects/trace/code/revolution.ray It contains default lighting of modeler Replace polymesh{} part with your own surface of revolution Render your new.ray file in tracer

SAMPLE RESULTS With texture mapping

BELLS AND WHISTLES TONS of Awesome Extra Credit!!! Antialiasing A must for nice scenes (to render scenes without jaggies ) Interpolate trimesh material properties will make them look nicer Environment/Texture/Bump Mapping Relatively easy ways to create complex, compelling scenes Single Image Random Dot Stereograms Depth of field, Soft shadows, Motion blur, Glossy reflection most images we re used to have at least one of these effects NOTE: Please add control boxes for substantial ray tracing modifications so the required extensions are easily gradable see sample solution style Especially things like anti-aliasing, glossy reflection, soft shadows, etc.

3D AND 4D FRACTALS

CONSTRUCTIVE SOLID GEOMETRY Allows for complex objects while still just intersecting simple primitives

USING PLY MODELS ply is one of the standard formats for 3D models http://en.wikipedia.org/wiki/ply_%28fil e_format%29 There are a lot of ply models available online We provide a simple tool that converts ply models into.ray files. You still need to add lighting and material property.

THE DREADED MEMORY LEAK!!! A Memory Leak can (and probably will) ruin your night of rendering hours before the artifact is due. depth 10, Anti-Aliasing, HUGE Image ALL MEMORY CONSUMED BY ray.exe at 1.8 GB on Hardware lab machines Cause: not calling free after allocating memory Object constructors, vector (array) creation It is HIGHLY RECOMMENDED you have no memory leaks Solution: call the delete [object] on ANYTHING you create that temporarily i.e. 3 byte temporary vectors in raytrace function