Given a compete 3D scene with viewinglighting conditions and object geometry and material properties fully specified First at Vertices then in the interior of the triangle Shading cgtradercom ID: 1034578
Download Presentation The PPT/PDF document "CS112: Shading How to determine the col..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
1. CS112: Shading
2. How to determine the color of each surface point?Given a compete 3D scene with viewing/lighting conditions and object geometry and material properties fully specifiedFirst at Vertices, then in the interior of the triangleShading[cgtrader.com]
3. Interaction between light and matterPhysics of optics (and thermal radiation)Very complex (e.g., light can bounce off several surfaces before reaching the eye)Geometric opticsLight travels in straight line (in vacuum)Neglects wave effects (e.g., diffraction and interference)Need further approximations for interactive renderingSimple and produces visually plausible resultsNeglecting/approximating indirect illuminationShading
4. Do NOT think of triangulated surfaces All vectors are unit vectorsMonochromatic light (i.e., single wavelength)Shading a Surface PointSurfaceNLθAngle of IncidenceθAngle of ReflectanceVRαP
5. Approximate interreflection (i.e., light bouncing off multiple surfaces)Inaccurate Directionally independent (i.e., equal contribution from all directions)Ia = intensity of ambient lightka = percentage of the light reflected by the objectCoefficient of ambient reflectionAmbient Reflection
6. Approximate “body reflection” of rough surfacesEqual amount of light reflected in all directionsDiffuse Reflection
7. Shading a Surface Point Ip = intensity of lightkd = diffuse coefficient If light is at infinity, L is constant over the whole surfaceSurfaceNLθθRP
8. Ambient and Diffuse Reflection
9. Did not take distance of the source from surface into account d = distance of light from the surfacea, b and c are user defined constantsDiffuse Reflection
10. Falloff of LightIncreasing distance from the light sourcea=0, b=0, c=1a=0.25, b=0.25, c=0.5a=0, b=1, c=0
11. Highlights on shiny surfacesAmount of reflection changes with viewpointThink of a mirror, perfectly specularPhong reflectance modelSpecular Reflection LRLR
12. Phong Reflectance Model : fall off as V moves away from Rn gives the sharpnessLθθVRαP
13. Phong Reflectance ModelComputing the reflected direction R:
14. Only one ambient light sourceMultiple point/directional sourcesAddition of light from different light sourcesCan be slow when there are many light sourcesMultiple Light Sources
15. Ambient
16. Ambient + Diffuse
17. Ambient + Diffuse + Specular
18. Chromatic Light Ambient Light : (IaR, IaG, IaB) Point (IpR, IpG, IpB)May have diffused and specular components(IdR, IdG, IdB) and (IsR, IsG, IsB)Object’s color by a RGB value: (OR, OG, OB)ambient, diffuse and specular components(OaR, OaG, OaB), (OdR, OdG, OdB), (OsR, OsG, OsB)Multiply by object color
19. Chromatic Light Each channel treated independentAmbient : IaCkaOC Diffuse: fattIpCkdOC(N.L)Specular: IpCks(R.V)OC Total for each channelOC(IaCka + fattIpCkd(N.L)+ IpCks(R.V))Different components OaCIaC + fattOdCIdC(N.L)+ OsCIsC(R.V)
20. Multiple Light sourcesOnly one ambient light sourceMultiple point light sourcesAddition of light from different light sources
21. How should we “shade” each pixel using the aforementioned models using the standard interactive rendering pipeline?Shading in Interactive Rendering
22. Evaluate shading model at the vertices of the trianglesNormally in the eye/camera space (after model-view transformation)Use interpolation to color the interior of the triangles during rasterizationDifferent shading methods use interpolation differentlyShading in Interactive Rendering
23. Normal ComputationNormal of a triangle Vertices are in anticlockwise direction with respect to normal Normal of a vertexAverage of all the triangle incident on the vertexABCN
24. Illumination model applied once per triangleUsing normal of the triangleShade the whole triangle uniformlyColor associated with triangles and not verticesConstant/Flat/Faceted Shading
25. Gouraud ShadingInterpolating illumination between verticesCalculate the illumination using vertex normals at verticesBilinear interpolation across the triangle
26. Edges get same color, irrespective of which triangle they are rendered fromShading is continuous at edgesTends to spread sharp illumination spots over the triangleCon: miss specular highlights within trianglesGouraud Shading
27. Not to be confused with the Phong reflectance modelInterpolate the normal across the triangleCalculate the illumination at every pixel during rasterizationUsing the interpolated normalCon: slower than GouraudPro: does not miss specular highlightsGood for shiny specular objectsPhong Shading
28. Gouraud vs. Phong ShadingSpreads highlights across the triangleMisses a highlight completelyGouraudPhongGouraudPhong
29. Flat Shading
30. Gouraud Shading
31. Phong Shading
32. Problem: the Phong reflectance model is NOT physics-based and does not closely resemble real-world materialsBidirectional reflectance distribution functions (BRDFs):Captures the fraction of lightbeing reflected into direction Vwith incident direction LThe Phong reflectance model isone realization of this formulationBeyond Phong Reflectance
33. To be physically plausible, a BRDF needs to beNonnegativeReciprocalEnergy conservingEmpirical modelsPhong, Blinn-PhongWardPhysics-based modelsMicrofacetCook-Torrance, Torrance-Sparrow, …Bidirectional Reflectance Distribution Functions