Materials Digital Image Synthesis Yung-Yu Chuang 11/19/2008 with slides by Robin Chen.

Slides:



Advertisements
Similar presentations
Shaders Information on Light, Shadows & Roughness.
Advertisements

1 Graphics CSCI 343, Fall 2013 Lecture 18 Lighting and Shading.
Week 9 - Monday.  What did we talk about last time?  BRDFs  Texture mapping and bump mapping in shaders.
Retrospect Digital Image Synthesis Yu-Ting Wu. So far we have learned: Geometry and transforms Shapes Accelerators Color and radiometry Cameras Sampling.
Light Issues in Computer Graphics Presented by Saleema Amershi.
Torrance Sparrow Model of Reflectance + Oren Nayar Model of Reflectance.
Week 9 - Wednesday.  What did we talk about last time?  Fresnel reflection  Snell's Law  Microgeometry effects  Implementing BRDFs  Image based.
Based on slides created by Edward Angel
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Shading I.
University of New Mexico
University of Texas at Austin CS395T - Advanced Image Synthesis Spring 2006 Don Fussell Previous lecture Reflectance I BRDF, BTDF, BSDF Ideal specular.
Part I: Basics of Computer Graphics
1 CSCE 641: Computer Graphics Lighting Jinxiang Chai.
Global Illumination May 7, Global Effects translucent surface shadow multiple reflection.
Rendering General BSDFs and BSSDFs Randy Rauwendaal.
Objectives Learn to shade objects so their images appear three- dimensional Learn to shade objects so their images appear three- dimensional Introduce.
Object recognition under varying illumination. Lighting changes objects appearance.
1 3D –graphics and animation Shading and Surface Characteristics Harri Airaksinen.
Shading, Surfaces & Textures
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Shading I Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
LIGHTING Part One - Theory based on Chapter 6. Lights in the real world Lights bounce off surfaces and reflect colors, scattering light in many directions.
CS 480/680 Computer Graphics Shading I Dr. Frederick C Harris, Jr.
© 2005 University of Wisconsin
Digital Image Synthesis Yung-Yu Chuang
Computer Vision Spring ,-685 Instructor: S. Narasimhan PH A18B T-R 10:30am – 11:50am Lecture #13.
CS 445 / 645: Introductory Computer Graphics
Shading (introduction to rendering). Rendering  We know how to specify the geometry but how is the color calculated.
Modelling and Simulation Types of Texture Mapping.
Shading / Light Thanks to Srinivas Narasimhan, Langer-Zucker, Henrik Wann Jensen, Ravi Ramamoorthi, Hanrahan, Preetham.
Geometry and Transformations Digital Image Synthesis Yung-Yu Chuang 9/28/2006 with slides by Pat Hanrahan.
Reflections Specular reflection is the perfect reflection of light from a surface. The law a reflection states that the direction of the incoming ray and.
Textures and Maps MCC Computer Modelling Trimester 1 – 2015/2016.
MIT EECS 6.837, Durand and Cutler Local Illumination.
4.1. R ENDERING Aspects of Game Rendering. From Wikipedia: Rendering is the process of generating an image from a model. The model is a description.
Advanced Illumination Models Chapter 7 of “Real-Time Rendering, 3 rd Edition”
Shapes Digital Image Synthesis Yung-Yu Chuang with slides by Pat Hanrahan.
BUMP-MAPPING SET09115 Intro to Graphics Programming.
Reflection models Digital Image Synthesis Yung-Yu Chuang 11/01/2005 with slides by Pat Hanrahan and Matt Pharr.
Photo-realistic Rendering and Global Illumination in Computer Graphics Spring 2012 Material Representation K. H. Ko School of Mechatronics Gwangju Institute.
Reflection models Digital Image Synthesis Yung-Yu Chuang 11/22/2007 with slides by Pat Hanrahan and Matt Pharr.
© Machiraju/Möller Fundamentals of Rendering - Reflectance Functions cis782 Advanced Computer Graphics Raghu Machiraju.
Shapes Digital Image Synthesis Yung-Yu Chuang 10/05/2006 with slides by Pat Hanrahan.
UV Mapping After a 3D object has been modeled it must be prepared for texturing. 3D surfaces can be “unwrapped” into a 2D representation with. This process.
02/2/05© 2005 University of Wisconsin Last Time Reflectance part 1 –Radiometry –Lambertian –Specular.
Color: This channel applies color, textured patterns, or images to the surface.
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.
COMPUTER GRAPHICS CS 482 – FALL 2015 SEPTEMBER 29, 2015 RENDERING RASTERIZATION RAY CASTING PROGRAMMABLE SHADERS.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
Materials Digital Image Synthesis Yung-Yu Chuang 11/08/2005 with slides by Robin Chen.
CDS 301 Fall, 2008 From Graphics to Visualization Chap. 2 Sep. 3, 2009 Jie Zhang Copyright ©
OpenGL Shading. 2 Objectives Learn to shade objects so their images appear three-dimensional Introduce the types of light-material interactions Build.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
Shapes Digital Image Synthesis Yung-Yu Chuang 10/1/2008 with slides by Pat Hanrahan.
Layered Media / Subsurface Scattering (1)
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
Computer Graphics Ken-Yi Lee National Taiwan University (the slides are adapted from Bing-Yi Chen and Yung-Yu Chuang)
Reflectance Models CS 319 Advanced Topics in Computer Graphics John C. Hart.
Computer Graphics: Illumination
Physics fundamentals of 3D rendering Szirmay-Kalos László Science is either physics or stamp collecting. Rutherford.
MAN-522 Computer Vision Spring
Digital Image Synthesis Yung-Yu Chuang 11/16/2006
Aspects of Game Rendering
Digital Image Synthesis Yung-Yu Chuang 11/16/2006
Previous lecture Reflectance I BRDF, BTDF, BSDF Ideal specular model
Digital Image Synthesis Yung-Yu Chuang 10/4/2005
Isaac Gang University of Mary Hardin-Baylor
Geometry and Transformations
CS5500 Computer Graphics May 29, 2006
Computer Graphics (Fall 2003)
Photon Density Estimation using Multiple Importance Sampling
Presentation transcript:

Materials Digital Image Synthesis Yung-Yu Chuang 11/19/2008 with slides by Robin Chen

Materials The renderer needs to determine which BSDFs to use at a particular point and their parameters. A surface shader, represented by Material, is bound to each primitive in the scene. Material=BSDF+Texture (canned materials) Material has a method that takes a point to be shaded and returns a BSDF object, a combination of several BxDFs with parameters from the texture. core/material.* materials/*

BSDFs BSDF =a collection of BxDF (BRDFs and BTDFs) A real material is likely a mixture of several specular, diffuse and glossy components. class BSDF {... const DifferentialGeometry dgShading; const float eta; private: Normal nn, ng; // shading normal, geometry normal Vector sn, tn; // shading tangents int nBxDFs; #define MAX_BxDFS 8 BxDF * bxdfs[MAX_BxDFS]; static MemoryArena arena; };

BSDF BSDF::BSDF(const DifferentialGeometry &dg, const Normal &ngeom, float e) : dgShading(dg), eta(e) { ng = ngeom; nn = dgShading.nn; sn = Normalize(dgShading.dpdu); tn = Cross(nn, sn); nBxDFs = 0; } inline void BSDF::Add(BxDF *b) { Assert(nBxDFs < MAX_BxDFS); bxdfs[nBxDFs++] = b; } refraction index of the medium surrounding the shading point.

BSDF Spectrum BSDF::f(const Vector &woW,const Vector &wiW, BxDFType flags) { Vector wi=WorldToLocal(wiW), wo=WorldToLocal(woW); if (Dot(wiW, ng) * Dot(woW, ng) > 0) // ignore BTDFs flags = BxDFType(flags & ~BSDF_TRANSMISSION); else // ignore BRDFs flags = BxDFType(flags & ~BSDF_REFLECTION); Spectrum f = 0.; for (int i = 0; i < nBxDFs; ++i) if (bxdfs[i]->MatchesFlags(flags)) f += bxdfs[i]->f(wo, wi); return f; } Use geometry normal not shading normal to decide the side to avoid light leak

Light leak ngng nsns ii ngng nsns ii

Material Material::GetBSDF() determines the reflective properties for a given point on the surface. class Material : public ReferenceCounted { public: virtual BSDF *GetBSDF(DifferentialGeometry &dgGeom, DifferentialGeometry &dgShading) const = 0; virtual ~Material(); static void Bump (Reference > d, const DifferentialGeometry &dgGeom, const DifferentialGeometry &dgShading, DifferentialGeometry *dgBump); }; real geometry around intersection shading geometry around intersection Calculate the normal according to the bump map

Matte Purely diffuse surface class Matte : public Material { public: Matte(Reference > kd, Reference > sig, Reference > bump) { Kd = kd; sigma = sig; bumpMap = bump; } BSDF *GetBSDF(const DifferentialGeometry &dgGeom, const DifferentialGeometry &dgShading) const; private: Reference > Kd; Reference > sigma, bumpMap; }; essentially a height map

Matte BSDF *Matte::GetBSDF(DifferentialGeometry &dgGeom, DifferentialGeometry &dgShading) { DifferentialGeometry dgs; if (bumpMap) Bump(bumpMap, dgGeom, dgShading, &dgs); else dgs = dgShading; BSDF *bsdf = BSDF_ALLOC(BSDF)(dgs, dgGeom.nn); Spectrum r = Kd->Evaluate(dgs).Clamp(); float sig = Clamp(sigma->Evaluate(dgs), 0.f, 90.f); if (sig == 0.) bsdf->Add(BSDF_ALLOC(Lambertian)(r)); else bsdf->Add(BSDF_ALLOC(OrenNayar)(r, sig)); return bsdf; }

Lambertian

Oren-Nayer model

Plastic A mixture of a diffuse and glossy scattering function with parameters, kd, ks and rough BSDF *Plastic::GetBSDF(...) { Spectrum kd = Kd->Evaluate(dgs).Clamp(); BxDF *diff = BSDF_ALLOC(Lambertian)(kd); Fresnel *f=BSDF_ALLOC(FresnelDielectric)(1.5f,1.f); Spectrum ks = Ks->Evaluate(dgs).Clamp(); float rough = roughness->Evaluate(dgs); BxDF *spec = BSDF_ALLOC(Microfacet)(ks, f, BSDF_ALLOC(Blinn)(1.f / rough)); bsdf->Add(diff); bsdf->Add(spec); return bsdf; }

Plastic

Additional materials There are totally 14 material plug-ins available in pbrt. Most of them are just variations of Matte and Plastic. Translucent : glossy transmission Mirror : perfect specular reflection Glass : reflection and transmission, Fresnel weighted ShinyMetal: a metal surface with perfect specular reflection Substrate: layered-model Clay, Felt, Primer, Skin, BluePaint, Brushed Metal : measured data fitted by Lafortune Uber: a “union” of previous material; highly parameterized

Blue paint (measured Lafortune)

Substrate

Bump mapping Displacement mapping adds geometrical details to surfaces Bump mapping: augments geometrical details to a surface without changing the surface itself It works well when the displacement is small p p’=p+d(p)n(p) n(p)

Bump mapping Displacement mapping adds geometrical details to surfaces Bump mapping: augments geometrical details to a surface without changing the surface itself It works well when the displacement is small p p’=p+d(p)n(p) n(p)

Bump mapping

To use bump mapping, a displacement map is often converted into a bump map (normal map)

Bump mapping often ignored because d(u,v) is small. But, adding constant to d won’t change appearance then. Pbrt adds this term. Material::Bump(…) does the above calculation the only unknown term

Material::Bump DifferentialGeometry dgEval = dgs; // Shift _dgEval_ in the $u$ direction float du = 0.5*(fabsf(dgs.dudx)+fabsf(dgs.dudy)); if (du == 0.f) du =.01f; dgEval.p = dgs.p + du * dgs.dpdu; dgEval.u = dgs.u + du; dgEval.nn = Normalize((Normal)Cross(dgs.dpdu,dgs.dpdv) + du*dgs.dndu); Float uDisplace = d->Evaluate(d gEval); float displace = d->Evaluate(dgs); // do similarly for v

Material::Bump *dgBump = dgs; dgBump->dpdu = dgs.dpdu + (uDisplace-displace)/du * Vector(dgs.nn) + displace * Vector(dgs.dndu); dgBump->dpdv =... dgBump->nn = Normal(Normalize( Cross(dgBump->dpdu, dgBump->dpdv)));... // Orient shading normal to match geometric normal if (Dot(dgGeom.nn, dgBump->nn) < 0.f) dgBump->nn *= -1.f;

without bump mapping with bump mapping