DOC PREVIEW
UCSD CSE 168 - Lecture

This preview shows page 1-2-3-24-25-26-27-48-49-50 out of 50 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 50 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 50 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 50 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 50 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 50 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 50 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 50 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 50 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 50 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 50 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 50 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CSE168Computer Graphics II, RenderingSpring 2006Matthias ZwickerLast time• Course overview• Ray tracing algorithm• Computing primary raysToday• Ray-surface intersection• Implicit, parametric surfaces• Spheres, triangles, polygons•ShadingRay tracing pseudocodefor all pixels {computeprimary( &ray )for all objects {intersect( ray, &hit )if hit is closer than firsthit {firsthit = hit}}shade( firsthit )}Implicit surfaces• Implicit surfaces are defined by•Surface normal• Given a ray• Ray-surface intersectionExample: infinite plane• Normal , point on plane• Intersection with•Surface normalParametric surfaces• Parameters•Surface normal• Cross product of tangent vectorsParametric surfaces• Ray-surface intersection• Easy to solve for parametric planes (see ray-triangle intersection)• Requires iterative solution for most non-linear surfaces (e.g., NURBS)Ray-sphere intersection• Sphere with center , radius•Use• RearrangeRay-sphere intersection•Surface normal• Unit normalRay-triangle intersection• Parametric description of a triangle with vertices • Convention: vertices are ordered counter-clockwise as seen from the outsideRay-triangle intersection• Outward-pointing normal• Triangle in barycentric coordinatesRay-triangle intersection• Intersection condition• One equation for each coordinateRay-triangle intersection• In matrix form• Solve for using Cramer’s rule (Shirley page 157)Interpolating normals• Sometimes, we store a normal with each vertex• Interpolating normals at barycentriccoordinates• The same for other vertex attributesRay-polygon intersection•Vertices• Polygon lies on plane• Intersection with ray• Determine whether lies within the polygonRay-polygon intersectionor planeRay-polygon intersectionor planeRay-polyigon intersectionor planeRay-polygon intersectionor planeThe hit recordclass hit_record {t // intersection parameterp // intersection pointn // normal at intersection point*object // pointer to hit object}Intersecting transformed objects• Primary rays are in world coordinates• Objects may be expressed in local object coordinates• TransformationIntersecting transformed objects• Transform rays from world to object coordinatesInstancing• Re-use objects without replicating them in memory• Allow additional transformationclass instance : object {*object // pointer to an objectM // object to world transformationM_inv // world to object transformation}• For intersection, transform ray instead of geometry• Hit record needs to be transformed back to world coordinates Instancinginstance::intersect( ray, &hit ) {ray_object = transform_ray( ray, M_inv )object->intersect( ray_object, &hit_object )hit = transform_hit( hit_object, M )}for all pixels {computeprimary( &ray )for all objects {intersect( ray, &hit )if hit is closer than firsthit {firsthit = hit}}shade( firsthit )}ShadingShading• Disclaimer•The BRDF• A simple model with diffuse, specular, and ambient componentsDisclaimer• Ultimate goal is to model physical process of light transport• Light transport is complicated in reality• For now, a hacker’s approach– Simple mathematical models, easy to implement– Loosely connected to physics– Reproduce perceptually prominent effectsDisclaimer• More physics background in the second part of the course• Colors, reflectance coefficients – RGB triplets– Each color value between 0 and 1The BRDF• Bi-directional reflectance distribution function• Describes how a surface reflects light– Locally, at a specific point•Contains almost all information about the appearance of surfaces– “Color”, shiny, glossy, mirror, matte, …The BRDF•Given– Light direction– Viewing direction•Return– Fraction of light arriving from source that is transported towards viewer– Function of two directions, i.e., 4 angles (variables/dimensions)The BRDF•Given– Light direction– Viewing direction•Return– Fraction of light arriving from source that is transported towards viewer– Function of two directions, i.e., 4 angles (variables/dimensions)The BRDF•Given– Light direction– Viewing direction•Return– Fraction of light arriving from source that is transported towards viewer– Function of two directions, i.e., 4 angles (variables/dimensions)The BRDF• More about physics of BRDFs (units) later• Frequency dependent, use RGB components• Real materials have spatially varying BRDFs– Different BRDF at each point– Function with 6 degrees of freedom/dimensions (two for location on the surface, 4 for directions)A simple model• Sum of 3 componentsambientdiffusespecularDiffuse term• Matte, not shiny materials• Highly diffuse materials–Paper– Unfinished wood– Unpolished stone• View-independentDiffuse termfixed“slice” through BRDFDiffuse term• Ideal diffuse surfaces follow Lambert’s lawwhere is apparentsurface color•Surface normal• Light direction•Unit vectors!Diffuse term•Practical model–Light color– Surface color– Avoid negative dot products• Two-sided lightingSpecular term• Highlights• View dependent– Highlights move across surfaces as the viewpoint moves• Blurry reflections of light sources• Are often the color of the light source (e.g. plastics, but not metals)Specular termFixed“Specular lobe”Specular highlights• Phong shading• Reflected light direction• Viewing direction• Phong exponentSpecular highlights• Unit reflection vectorSpecular highlights• Alternative formulation• Halfway vectorSpecular highlights• Varying specular exponents[Shirley]Ambient term• “Ambient, omni-directional” light• Account for light that is not directly emitted from light sources• Cheapest of all hacks• Several light sourcesCombined lighting modelambientdiffusespecularPoint and directional lights• Directional light– Approximates light sources far away from objects– Constant direction• Point light–Direction changes over surfacesPointlightDirectionallightFalloff, spot lights• Physically, intensity falloff from point light• Looks bad, in practice• Spot lightDiscussion section• Tomorrow Thursday• 11:00-12:30, EBU3B b250• Introduction to base


View Full Document

UCSD CSE 168 - Lecture

Download Lecture
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?