Download presentation
Presentation is loading. Please wait.
1
Illumination and Shading
2
Rendering Simulation of physical interaction of light and matter. Physically correct shading is too complex –Material layers –Inter-object relations Good approximations are possible –Physical models when CPU available –Heuristics that look good
3
Light Sources Point source (A) –Light originates from a point –The point may be at infinity –Approximation for light sources whose dimensions are small relative to objects A B C
4
Light Sources Parallel source –Light rays are parallel –Can be modeled as a light source in infinity –Approximation for far sources A B C
5
Light Sources Light originates at a finite area –Windows –Fluorescent Sometimes called distributed source A B C
6
Light Sources Example Parallel light source Point light source
7
Illumination models Material has following properties –Ambient –Diffuse –Specular
8
Illumination models Material has following properties –Ambient Compensates for global interactions Assumes non directional light in the environment The shading equation: I = I A K A, I A – ambient light, K A – surface parameter –Diffuse –Specular
9
Illumination models Material has following properties –Ambient –Diffuse Represents matt (non shining) surfaces Known as Lambert model Reflects lights in all directions Reflected light is proportional to I = I D K D –Specular L N
10
Illumination models Material has following properties –Ambient –Diffuse –Specular Shiny (metallic) surfaces reflect light in preferred direction Ideal shiny surface reflects only in one direction R Phong specularity exponent (no physical basis) n L R V
11
Illumination models Material has following properties –Ambient –Diffuse –Specular Computing R
12
Illumination Equation Definitions –N – point normal –V – viewing direction –L – lighting direction –R – reflection direction –D – diffuse, A – ambient, S – specular –I – intensity –K – surface coefficient, –θ – angle between V and L –α – angle between V and R n L R V
13
Illumination comparison Ambient Diffuse Specular, n = 100 Specular, n = 8
14
Shading Constant Gouraud Phong
15
Shading Constant –Color each polygon according to its normal Gouraud Phong
16
Shading Constant Gouraud –Compute exact colors for vertexes –Interpolate colors for interior pixels of polygon –We can miss specular highlights Phong
17
Shading Constant Gouraud Phong (default Inventor model) –Compute normals for vertexes –Interpolate normals for interior pixels –Compute color according to pixel normal
18
Shading Example
19
Interpolation scanline
20
Lights in Inventor Light node in Inventor determines –What the light illuminates (following nodes) –Where it is located (affected by current transformation) Light sources are cumulative SoTransformSeparator –Light should not be under standard separator –You can separate only light transformation –Only the light position can be changed
21
Light Nodes SoLight fields –On (SoSFBool) If the source is turned on / off –Intensity (SOSFFloat) 0 – minimum 1 – maximum –color (SOSFColor) Color of the light
22
Light Nodes SoPointLight (Point Source) – location (SoSFVec3f) 3D location of a point light source affected by current geometric transformation
23
Light Nodes SoDirectionalLight (Parallel source) –direction (SOSFVec3f) Direction of rays Affected by current transformation
24
Light Nodes SoSpotLight –A point light restricted to a cone – location (SoSFVec3f) 3D location of a point light source affected by current geometric transformation – direction (SoSFVec3f) primary direction of illumination – dropOffRate (SoSFFloat) rate at which the light intensity drops off from the primary direction. 0.0 = constant intensity 1.0 = sharpest drop-off
25
Light Nodes cutOffAngle (SoSFFloat) –angle, in radians, where the intensity is 0.0 –measured from one cone edge to the other
26
Light Nodes Directional lights are the fastest Spotlights are the slowest To increase speed use fewer lights
27
Multiple Lights Example The example contains: –A red stationary directional light –A green light moved back and forth by SoShuttle
28
Example // Add a directional light SoDirectionalLight *myDirLight = new SoDirectionalLight; myDirLight->direction.setValue(0, -1, -1); myDirLight->color.setValue(1, 0, 0); // red root->addChild(myDirLight); // Add shuttle and point light SoShuttle *myShuttle = new SoShuttle; myTransformSeparator->addChild(myShuttle); myShuttle->translation0.setValue(-2, -1, 3); myShuttle->translation1.setValue( 1, 2, -3); SoPointLight *myPointLight = new SoPointLight; myTransformSeparator->addChild(myPointLight); myPointLight->color.setValue(0, 1, 0); // green
29
Surface Material Opaque surface –Light is reflected and absorbed Transparent surface –Light is reflected and transmitted SoMaterial contains –transparrency (SoMFFloat) 0.0 for opaque 1.0 for transparent
30
Surface material The amount reflected depends on material –Shiny reflect more Intensive brightness in one direction –Rough reflect less Equally bright from all directions SoMaterial contains –shininess (SoMFFloat) 0.0 for diffuse 1.0 for metallic –diffuseColor (SoMFColor) K D –specularColor (SoMFColor) K S
31
Ambient light Models inter-object relations The object is illuminated with the same light everywhere One equation for each channel R,G,B. SoEnvironment contains –ambientIntensity ( SoSFFloat) I A –ambientColor (SoSFColor) K AE (environment) SoMaterial contains –ambientColor (SoSFColor) K AM (material) K A = K AE *K AM
32
Ray Tracing
34
Radiosity Direct IlluminationGlobal Illumination
35
Radiosity
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.