1 / 21

Basic Lighting and Shading

Basic Lighting and Shading. The Important Properties of Light. It can Reflect, bend, spread and scatter. Most Common Light Sources. Global Illumination Light Located at Infinity (Distant Light) Light Located Locally Uniform Light (Ambient) Point Source

kedma
Télécharger la présentation

Basic Lighting and Shading

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Basic Lighting and Shading

  2. The Important Properties of Light • It can Reflect, bend, spread and scatter

  3. Most Common Light Sources • Global Illumination • Light Located at Infinity (Distant Light) • Light Located Locally • Uniform Light (Ambient) • Point Source • Intensity is L(p,P0) = (1 / |p-p0|2 ) L(P0) • Spotlights (Directional Lights)

  4. OpenGL Light Types Point Spotlight Ambient Distant

  5. Point home.elka.pw.edu.pl/.../general/General.html

  6. Spot home.elka.pw.edu.pl/.../general/General.html

  7. Ambient (Area) home.elka.pw.edu.pl/.../general/General.html

  8. Distant (Sun / Moon) home.elka.pw.edu.pl/.../general/General.html

  9. Physical Light Bidirectional Reflection Distribution Function • (BRDF) This is based on 5 Variables: • Frequency • Source Vector (x,y) • Output Vector (x,y) • It also requires a ‘real’ surface

  10. This is a hugely expensive calculation • Most light consists of a large frequency Range • In games we have many fast ways of creating the effects of light

  11. Firslty we need to get rid of the ‘spectrum’ • The human Eye recognises colours through 3 types of cones • We can exploit this behaviour by directly addressing the cones http://www.unenergy.org/index.php?p=1_180_CPV---Concentrated-PV http://www.atmos.ucla.edu/~fovell/AS3/theory_of_color.html

  12. By exploiting this behaviour we can define the colour of light as • RGB • Varying the levels of Red, Green and Blue can make the eye ‘see’ every colour of the spectrum.

  13. The downside to this simplification is that our model of light looses the ability to separate during reflections/refractions. • As a solution to this we can either use multiple lights, or use explicit functions to ‘create’ light separation • For offline rendering you may even consider doing a BRDF Rendering using a more complex Lighting method http://www.tufts.edu/as/tampl/projects/micro_rs/theory.html

  14. Using Basic Lighting in OpenGL http://www.cs.virginia.edu/~gfx/Courses/2002/RealTime.fall.02/Cg/CG%20Effects%20Explained/Cg%20Effects%20Explained.htm

  15. Enabling Lighting Enable Lighting in OpenGL glEnable(GL_LIGHTING) Enable Each Individual Light glEnable(GL_LIGHTi) i <= GL_MAX_LIGHTS All implementations support at least 8 lights

  16. The 3 Functions to set you lights • glLightfv(…) • glLightf(…) • glLightModelfv(…)

  17. Specular Reflection • Specular • The more specular a surface, the move light is reflected very closely to the angle of reflection • A mirror is a near perfect Specular Surface http://www.indigorenderer.com/joomla/forum/files/specular_material_test_01_168.jpg

  18. Diffuse Reflection(Lambertian reflection) http://torcode.com/ http://www.glenspectra.co.uk/SiteResources/Data/Templates/1product.asp?DocID=389&v1ID=

  19. Emissive • It Glows! http://www.gennetten-concreteartist.com/d-network.html

  20. Translucent Surfaces http://www.trinity3d.com/product.php?productid=1572&cat=293&page=2 http://www.nondot.org/sabre/Projects/Raytracer/

  21. The End (for now)

More Related