04: surfaces & sound
surface nodes
Appearance{} : the place to define materials and textures
Material{} : provides parameters to control surface properties of the shape
example: [»]
lighting nodes
DirectionalLight{} : straight parallel beams simulate a distant source [»]
PointLight{} : rays emanate from a central point, like an exposed bulb [»]
SpotLight{} : casts a cone of light [»]
vrml lighting model
ideally, lighting values would be calculated per pixel (Phong shading).
Most commonly, though, browsers calculate lighting values at vertices, and
interpolate them across the face of a polygon (Gouraud shading).
This has significant implications for hilights:
- vertices and light quality [»]
- vertices and specular quality [»]
lighting considerations
- if the browser sees
diffuseColor, ambientIntensity, and specularColor all set to 0,
it should exclude the shape from any lighting calculations and render it solely in its emissive color
- if Gouraud shading, better lighting
= more vertices + smaller polygons
- light mixes via multiplication; consider red * blue:
(1 0 0) * (0 0 1) = (0 0 0)
- avoid hotspots where many lights illuminate the same vertices
- in terms of cpu cost, directional lights are cheapest, then point lights, then spot lights
- directional lights are scoped by grouping nodes
- point and spot lights have radius fields to limit their impact on the scene
- the vrml specification only requires browser support for eight simultaneous lights
lighting examples
- additive color mixing [»]
- light and surface color mixing [»]
- scoping directional lights [»]
- faking shadows [»]
sound nodes
Sound{} : orients and shapes the sound space
AudioClip{} : the actual sound and its pitch
cortona will play mp3, wav, midi
visualizing sound
two ellipsoids; within the inner limit volume is 100%. Beyond the outer limit
volume is 0%. Between the inner and outer limits, volume changes linearly from 100% to 0%:
ambient sound
to create sound that can be heard everywhere in the scene regardless of position
or orientation (like a movie sound track):
spatialize = FALSE
loop = TRUE
- inner sound ellipsoid
= outer sound ellipsoid =
bounding dimensions of scene
directional sound
to add sound effects that should seem attached to an object or place in the scene:
spatialize = TRUE
loop = FALSE
- inner sound ellipsoid is just big enough to fit the object and a listener
- outer sound ellipsoid is as big as the sound should carry
direction should be specified so sound emanates properly
sound considerations
- avoid hotspots where too many sounds overlap
- make ellispoinds as small as practical
- most vrml browsers can only play 6-8 simultaneous sounds
- spatialization costs extra cpu cycles
- in vrml, pitch and duration are directly linked
- mp3s may be problematic with spatialization
sound examples
- the basics [»]
- sound vista [»]
- pitch and duration [»]
- moving sounds [»]
- reactive sounds [»]