Autumn 2010 Help Session Christopher Raastad

Slides:



Advertisements
Similar presentations
16.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 16 – Some Special Rendering Effects.
Advertisements

Ray tracing. New Concepts The recursive ray tracing algorithm Generating eye rays Non Real-time rendering.
3D Graphics Rendering and Terrain Modeling
Week 9 - Wednesday.  What did we talk about last time?  Fresnel reflection  Snell's Law  Microgeometry effects  Implementing BRDFs  Image based.
Christian Lauterbach COMP 770, 2/11/2009
CS6500 Adv. Computer Graphics © Chun-Fa Chang, Spring 2003 Object-Order vs. Screen-Order Rendering April 24, 2003.
CS 376 Introduction to Computer Graphics 04 / 09 / 2007 Instructor: Michael Eckmann.
Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008.
Real-Time High Quality Rendering COMS 6160 [Fall 2004], Lecture 4 Shadow and Environment Mapping
Global Illumination May 7, Global Effects translucent surface shadow multiple reflection.
Ray Tracing Outline For each pixel { Shoot ray r from eye to center of pixel with trace( r ) } function trace( r ) For each object { Find object with closest.
1 7M836 Animation & Rendering Global illumination, ray tracing Arjan Kok
CIS 310: Visual Programming, Spring 2006 Western State College 310: Visual Programming Ray Tracing.
Ray Tracing 1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009.
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
Computer Graphics Inf4/MSc Computer Graphics Lecture 11 Texture Mapping.
09/18/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Bump Mapping Multi-pass algorithms.
Cornell CS465 Fall 2004 Lecture 3© 2004 Steve Marschner 1 Ray Tracing CS 465 Lecture 3.
Cornell CS465 Fall 2004 Lecture 3© 2004 Steve Marschner 1 Ray Tracing CS 465 Lecture 3.
Presentation by Dr. David Cline Oklahoma State University
COMP 175: Computer Graphics March 24, 2015
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Today More raytracing stuff –Soft shadows and anti-aliasing More rendering methods –The text book is good on this –I’ll be using images from the CDROM.
CS 376 Introduction to Computer Graphics 04 / 11 / 2007 Instructor: Michael Eckmann.
-Global Illumination Techniques
Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand.
Ray Tracing Chapter CAP4730: Computational Structures in Computer Graphics.
Ray Tracing Jian Huang, CS 594, Fall, 2002 This set of slides are used at Ohio State by Prof. Roger Crawfis.
Rendering Overview CSE 3541 Matt Boggus. Rendering Algorithmically generating a 2D image from 3D models Raster graphics.
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
Ray Tracer Winter 2014 Help Session Due: Tuesday, Feb 25 th, 11:59pm TA: Will Gannon.
Computer Graphics 2 Lecture 7: Texture Mapping Benjamin Mora 1 University of Wales Swansea Pr. Min Chen Dr. Benjamin Mora.
Intro. to Advanced Lighting, Basic Ray Tracing Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Monday, April.
Ray Tracer Spring 2008 Help Session. Outline Project Web Resources What do you have to do for this project? Ray Class Isect Class Requirements Tricks.
Alex YAU Important Notes Website for Assignment #2 You.
- Laboratoire d'InfoRmatique en Image et Systèmes d'information
CS380: Computer Graphics Distributed Ray Tracing TA Course URL:
Lecture 6 Rasterisation, Antialiasing, Texture Mapping,
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
Project 3 Help Session: Ray Tracing. Getting Started Download the starter pack. 1.sample_ray.exe 2.ray-skel directory 3.scenes directory Look at the Road.
More on Ray Tracing Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Wednesday, April 14, 2004.
RENDERING : Global Illumination
Global Illumination (3) Path Tracing. Overview Light Transport Notation Path Tracing Photon Mapping.
CS 325 Introduction to Computer Graphics 04 / 07 / 2010 Instructor: Michael Eckmann.
Ray Tracer Help Session. Outline Introduction ray vec.h and mat.h isect Requirements Tips and Tricks Memory Leaks Artifact Requirement Ray Tracing Surface.
Ray Tracer Help Session.
Basic Ray Tracing CMSC 435/634.
Photorealistic Rendering vs. Interactive 3D Graphics
Ray Tracer Spring 2007 Help Session.
Deferred Lighting.
3D Graphics Rendering PPT By Ricardo Veguilla.
Texture Mapping COMP575/COMP770.
Mike Merchant Nicholas Hilbert
© University of Wisconsin, CS559 Fall 2004
Transformations.
An Approximation of Volumetric Lighting
Ray Tracer Project CSE 557.
(c) 2002 University of Wisconsin
Lecture 11: Recursive Ray Tracer
UMBC Graphics for Games
Distributed Ray Tracing
(c) 2002 University of Wisconsin
Image.
CS5500 Computer Graphics May 29, 2006
Ray Tracer Spring 2004 Help Session.
GR2 Advanced Computer Graphics AGR
Ray Tracer Project CSE 557.
Ray Tracer Spring 2008 Help Session.
Ray Tracer Autumn 2005 Help Session.
Ray Tracer Spring 2006 Help Session.
Presentation transcript:

Autumn 2010 Help Session Christopher Raastad Ray Tracer Autumn 2010 Help Session Christopher Raastad

Outline Project Web Resources What do you have to do for this project? Ray Class Isect Class Requirements Tricks Artifact Requirement Bells and Whistles

Project Web Page Roadmap Overview of files STL Information http://www.cs.washington.edu/education/courses/cse457/CurrentQtr/projects/trace/ Roadmap Overview of files STL Information List of useful equations File format description Debugging display documentation Triangle intersection handout

Welcome to the Raytracer Project Basically, you are given a RayTracer 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 A 3D ray is the fundamental component of a raytracer. Start position ray Class r.at(t) A 3D ray is the 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), a method that determines the position of the ray r as a function of t, the distance from the start position (t*direction vector) r.at(t) => where the end of the ray points at (a distance t away from the start point)

VEC.H, mat.h: Provided MATH LIBRARIES vec.h gives us useful tools for 2D, 3D, and 4D vectors: Easy Vector Construction eg. Vec3d x = Vec3d(0,0,0); or Vec4d y = Vec4d(255,255,255,1); +,-,*,DotProduct and CrossProduct are operator overloaded operations +,-,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() mat.h is very similar but for matrix operations not heavily used in this project

isect Class An isect represents the location where a ray intersects a specific 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 This data structure is used to record the details of a ray’s intersection with an object as implemented in an object’s intersection routine.

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] ]; Set up isect i as in the sphere intersection and return true if ray r intersects the plane containing triangle abc and the intersection is within the triangle. More Help? See page linked to on project website http://www.cs.washington.edu/education/courses/457/CurrentQtr/projects/trace/extra/triangle_intersection.pdf

Requirement: Blinn-Phong specular-reflection model Fill in Material::shade in material.cpp: Refer to the RayTracing lecture: http://www.cs.washington.edu/education/courses/457/CurrentQtr/lectures/ray-tracing.pdf To sum over the light sources, use an iterator as described in the comments of the code. CAUTION! If you are inside an object, the object’s normal will point outside. You will need to flip that normal for any shading, reflection, or refraction. (Unless of course you like funky images and less points…)

Requirement: Contribution from multiple light sources Fill in PointLight::distanceAttenuation in light.cpp (DirectionalLight::distanceAttenuation is already 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). Count each intersection with an object by the shadow ray (which may include entering and exiting). See Foley, et. al. Section 16.12– this particular method is not really covered in lecture slides Extra Credit: Better shadow handling (caustics, global illumination, etc.) Again, Check out the ray-tracing lecture: http://www.cs.washington.edu/education/courses/457/CurrentQtr/lectures/ray-tracing.pdf

Requirement: Reflection Modify RayTracer::traceRay in RayTracer.cpp to implement recursive ray tracing which takes into account reflected rays. See Foley, et. al. and lecture slides.

Requirement: Refraction Modify RayTracer::traceRay in RayTracer.cpp to implement recursive ray tracing which takes into account refracted rays. Remember Snell’s law, watch out for total internal refraction, and consider the case when the ray is exiting a material into air (think about the direction of the normal) You can test with simple/cube_transparent.ray Warning: Unlike reflection, this routine has several cases to consider: an incoming ray an outgoing ray totally internally refracted ray. nglass=1.5 nair=1.0003

TIPS AND Tricks RAY_EPSILON RAY_EPSILON RAY_EPSILON Use the sign of the dot product r.getDirection() with i.N to determine whether you’re entering or exiting an object DON’T WRITE TOO MUCH CODE WITHOUT TESTING!!!! Lots of dependencies, you need to know what works to proceed. RAY_EPSILON RAY_EPSILON RAY_EPSILON Use RAY_EPSILON (which is defined as 0.00001) to account for computer precision error when checking for intersections YHBW= you have bee warned RAY_EPSILON

The Debugger tool is your best friend

Artifact Requirement Draw a pretty picture! One JPEG/PNG image per person 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).

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 Definition: unstoppable (except program termination) increase in acquired memory (most which is not being useful, and un-namable in the program) Cause: not calling free after allocating memory Object constructors, vector (array) creation It is HIGHLY RECOMMENDED you have no memory leaks Solution, free stuff! Call the “delete [object]” on ANYTHING you create that temporarily i.e. 3 byte temporary vectors in rayTrace function

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 – I have no idea, but they look cool! 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