Digital Image Synthesis Yung-Yu Chuang 9/28/2006

Slides:



Advertisements
Similar presentations
Retrospect Digital Image Synthesis Yu-Ting Wu. So far we have learned: Geometry and transforms Shapes Accelerators Color and radiometry Cameras Sampling.
Advertisements

Course overview Digital Image Synthesis Yung-Yu Chuang 9/20/2007 with slides by Mario Costa Sousa, Pat Hanrahan and Revi Ramamoorthi.
Course overview Digital Image Synthesis Yung-Yu Chuang 9/17/2009 with slides by Mario Costa Sousa, Pat Hanrahan and Revi Ramamoorthi.
3D Rendering with JOGL Introduction to Java OpenGL Graphic Library By Ricardo Veguilla
Digital Image Synthesis Yung-Yu Chuang
Surface Integrators Digital Image Synthesis Yung-Yu Chuang with slides by Peter Shirley, Pat Hanrahan, Henrik Jensen, Mario Costa Sousa and Torsten Moller.
Cornell CS465 Fall 2004 Lecture 1© 2004 Steve Marschner 1 CS465: Computer Graphics I Professor: Steve Marschner.
Acceleration Digital Image Synthesis Yung-Yu Chuang 10/4/2005 with slides by Mario Costa Sousa and Pat Hanrahan.
CS-557 Gregory Dudek CD Contents. CS-557 Gregory Dudek Course description Lecture schedule by week 1997 Image Gallery Assignments Page Morphing Notes.
COMP 175: Computer Graphics March 24, 2015
Geometry and Transformations Digital Image Synthesis Yung-Yu Chuang 9/28/2006 with slides by Pat Hanrahan.
Surface Integrators Digital Image Synthesis Yung-Yu Chuang with slides by Peter Shirley, Pat Hanrahan, Henrik Jensen, Mario Costa Sousa and Torsten Moller.
Course overview Digital Image Synthesis Yung-Yu Chuang 9/20/2005 with slides by Mario Costa Sousa, Pat Hanrahan and Revi Ramamoorthi.
Ray Tracing POV Oz Levy Yulia Shnaider
Computer Graphics. Requirements Prerequisites Prerequisites CS 255 : Data Structures CS 255 : Data Structures Math 253 Math 253 Experience with C Programming.
Project Raytracing. Content Goals Idea of Raytracing Ray Casting – Therory – Practice Raytracing – Theory – Light model – Practice Output images Conclusion.
RenderMan Introduction CS 551/645 Fall Evaluate Me! Please visit the SEAS main website and use the ‘Course Evaluations’ button to rate this class.
Digital Image Synthesis Yung-Yu Chuang
Materials Digital Image Synthesis Yung-Yu Chuang 11/19/2008 with slides by Robin Chen.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
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.
Reflection models Digital Image Synthesis Yung-Yu Chuang 11/01/2005 with slides by Pat Hanrahan and Matt Pharr.
CS380: Computer Graphics Distributed Ray Tracing TA Course URL:
Materials Digital Image Synthesis Yung-Yu Chuang 11/08/2005 with slides by Robin Chen.
01/19/05© 2005 University of Wisconsin CS 779: Rendering Prof Stephen Chenney Spring 2005
Surface Integrators Digital Image Synthesis Yung-Yu Chuang with slides by Peter Shirley, Pat Hanrahan, Henrik Jensen, Mario Costa Sousa and Torsten Moller.
RENDERING : Global Illumination
Ray Tracing I. Reading Hill, Chapter 14, Sections 14.1 to 14.5 Hill, Chapter 14, Sections and
Lesson Plan: Drafting and Design J6-2. What is 3D solid modeling? How do 3D solid modeling programs work?
Advanced Computer Graphics
Digital Image Synthesis Yung-Yu Chuang 10/25/2007
Computer Graphics.
Digital Image Synthesis Yung-Yu Chuang 10/8/2009
C Primer.
Photorealistic Rendering vs. Interactive 3D Graphics
Visualization Shading
Characters and Strings
Monte Carlo Integration
Digital Image Synthesis Yung-Yu Chuang 12/24/2008
Digital Image Synthesis Yung-Yu Chuang
3D Graphics Rendering PPT By Ricardo Veguilla.
Digital Image Synthesis Yung-Yu Chuang 11/16/2006
The Graphics Rendering Pipeline
Models and Architectures
© University of Wisconsin, CS559 Fall 2004
Models and Architectures
Models and Architectures
Introduction to Computer Graphics with WebGL
Shading CMSC 435/634.
CS 240 – Lecture 18 Command-line Arguments, Typedef, Union, Bit Fields, Pointers to Functions.
Lecture 11: Recursive Ray Tracer
Digital Image Synthesis Yung-Yu Chuang 10/4/2005
Digital Image Synthesis Yung-Yu Chuang 9/27/2005
Digital Image Synthesis Yung-Yu Chuang 11/01/2005
Digital Image Synthesis Yung-Yu Chuang 10/19/2006
Digital Image Synthesis Yung-Yu Chuang 10/22/2009
Geometry and Transformations
Strings and Pointer Arrays
14th Lecture – Final Lecture
Ray Tracer Spring 2004 Help Session.
Digital Image Synthesis Yung-Yu Chuang 12/3/2008
Digital Image Synthesis Yung-Yu Chuang 11/30/2006
Geometry and Transformations
Digital Image Synthesis Yung-Yu Chuang 9/24/2009
Digital Image Synthesis Yung-Yu Chuang 10/04/2007
Digital Image Synthesis Yung-Yu Chuang 11/8/2007
Characters and Strings
Digital Image Synthesis Yung-Yu Chuang 12/6/2007
Monte Carlo Path Tracing and Caching Illumination
Ray Tracer Autumn 2005 Help Session.
Presentation transcript:

Digital Image Synthesis Yung-Yu Chuang 9/28/2006 PBRT core Digital Image Synthesis Yung-Yu Chuang 9/28/2006 with slides by Pat Hanrahan

Announcements Please subscribe the mailing list. I will be attending Pacific Graphics 2006 from 10/11-10/13. The class of 10/12 will be cancelled. HW#1 will be assigned next week (10/5) and due on 10/26.

This course Study of how state-of-art ray tracers work

pbrt pbrt (physically-based ray tracing) attempts to simulate physical interaction between light and matter Plug-in architecture Core code performs the main flow and defines the interfaces to plug-ins. Necessary modules are loaded at run time as DLLs, so that it is easy to extend the system.

pbrt plug-ins

Example scene rendering options id “type” param-list LookAt 0 10 100 0 -1 0 0 1 0 Camera "perspective" "float fov" [30] PixelFilter "mitchell" "float xwidth" [2] "float ywidth" [2] Sampler "bestcandidate" Film "image" "string filename" ["test.exr"] "integer xresolution" [200] "integer yresolution" [200] # this is a meaningless comment WorldBegin AttributeBegin CoordSysTransform "camera" LightSource "distant" "point from" [0 0 0] "point to" [0 0 1] "color L" [3 3 3] AttributeEnd rendering options id “type” param-list “type name” [value]

Example scene AttributeBegin Rotate 135 1 0 0 Texture "checks" "color" "checkerboard" "float uscale" [8] "float vscale" [8] "color tex1" [1 0 0] "color tex2" [0 0 1] Material "matte" "texture Kd" "checks" Shape "sphere" "float radius" [20] AttributeEnd WorldEnd

Phases of execution main() in renderer/pbrt.cpp int main(int argc, char *argv[]) { <Print welcome banner> pbrtInit(); // Process scene description if (argc == 1) { // Parse scene from standard input ParseFile("-"); } else { // Parse scene from input files for (int i = 1; i < argc; i++) if (!ParseFile(argv[i])) Error("Couldn't open …\"%s\"\n", argv[i]); } pbrtCleanup(); return 0;

Scene parsing core/pbrtlex.l and core/pbrtparse.y After parsing, a scene object is created (core/scene.*) class scene { Primitive *aggregate; vector<Light *> lights; Camera *camera; (contains a film) VolumeRegion *volumeRegion; SurfaceIntegrator *surfaceIntegrator; VolumeIntegrator *volumeIntegrator; Sampler *sampler; BBox bound; }; primitive shape material aggregate … … (generates sample positions for eye rays and integrators)

Rendering Scene::Render() is invoked.

Scene::Render() while (sampler->GetNextSample(sample)) { RayDifferential ray; float rayW=camera->GenerateRay(*sample,&ray); <Generate ray differentials for camera ray> float alpha; opacity along the ray Spectrum Ls = 0.f; if (rayW > 0.f) Ls = rayW * Li(ray, sample, &alpha); ... camera->film->AddSample(*sample,ray,Ls,alpha); }

Scene::Li Spectrum Scene::Li(RayDifferential &ray, Sample *sample, float *alpha) { Spectrum Lo=surfaceIntegrator->Li(…); Spectrum T=volumeIntegrator->Transmittance(…); Spectrum Lv=volumeIntegrator->Li(…); return T * Lo + Lv; } Lv T Lo

Rendering equation p 5D light field

Surface integrator

Whitted model

Whitted integrator in integrators/whitted.cpp class WhittedIntegrator:public SurfaceIntegrator Spectrum WhittedIntegrator::Li(Scene *scene, RayDifferential &ray, Sample *sample, float *alpha) { ... bool hitSomething=scene->Intersect(ray,&isect); if (!hitSomething) {include effects of light without geometry} else { <Computed emitted and reflect light at isect> }

Whitted integrator n ωi ωo p BSDF *bsdf=isect.GetBSDF(ray); ... Vector wo=-ray.d; L+=isect.Le(wo); Vector wi; direct lighting for (u_int i = 0; i < scene->lights.size(); ++i) { VisibilityTester visibility; Spectrum Li = scene->lights[i]-> Sample_L(p, &wi, &visibility); if (Li.Black()) continue; Spectrum f = bsdf->f(wo, wi); if (!f.Black() && visibility.Unoccluded(scene)) L += f * Li * AbsDot(wi, n) * visibility.Transmittance(scene); } ωi ωo p

Whitted integrator if (rayDepth++ < maxDepth) { Spectrum f = bsdf->Sample_f(wo, &wi, BxDFType(BSDF_REFLECTION | BSDF_SPECULAR)); if (!f.Black()) { <compute rd for specular reflection> L += scene->Li(rd, sample) * f * AbsDot(wi, n); } f = bsdf->Sample_f(wo, &wi, BxDFType(BSDF_TRANSMISSION | BSDF_SPECULAR)); <compute rd for specular transmission>

Code optimization Two commonly used tips Divide, square root and trigonometric are among the slowest (10-50 times slower than +*). Multiplying 1/r for dividing r. Being cache conscious

Cache-conscious programming alloca AllocAligned(), FreeAligned() make sure that memory is cache-aligned Use union and bitfields to reduce size and increase locality Split data into hot and cold

Cache-conscious programming Arena-based allocation allows faster allocation and better locality because of contiguous addresses. Blocked 2D array, used for film w w h h … …. …. ….