SLIDE 10 10
Feb-22-05 SMM009, Shading 28 L
INSTITUTIONEN FÖR SYSTEMTEKNIK
LULEÅ TEKNISKA UNIVERSITET
Shading in OSG
Feb-22-05 SMM009, Shading 29 L
Steps in OSG Shading
- Specify material properties
- setDiffuse,setSpecular, setAmbient
+ Take a 4D vector, RGBα + For RGB 1.0=100% reflectivity, 0.0=0% + For α, 1.0=opaque, 0.0=transparent
- setShininess, bigger gives smaller specular highlights
- Specify normal vectors
- Default for OSG primitive objects
- In OSG the normal vector is part of the drawable
- Usually bound per vertex
Feb-22-05 SMM009, Shading 30 L
Steps in OSG Shading
- Specify lights, point sources
- setLightNum, different for each source, limited but at least 8
- setPosition, 4D vector,
w=1 for finite distance, 0 for infinite
- setDirection, 3D vector pointing in light’s direction
- setDiffuse, setSpecular, setAmbient
+ 4D vectors RBGα, α is used for blending
- Construct StateSet for
- Materials, attached to objects (drawables, Geodes)
- Root, gets the lights
- Stick the lights in a LightSource and enable
LightSource.setStateSetModes();