Fog can add significantly to the experience of depth within a world. You can add fog either in your script, or through the World tab of the Resources window.
There are four main properties for fog:
|
Property |
Description |
|
mode |
Fog can be rendered either in a linear or exponential relationship to the distance from the observer. |
|
color |
Sets the color of the fog. |
|
range |
Sets the beginning and ending distances of the fog from the observer. |
|
density |
Sets the density of the fog. |
The simplest way to add fog to your world is to go to the World tab of the Resources window. Click on Fog and then set your parameters in the Properties window.
You can also add fog within your script using the viz.fog() command. The fog equations used depend on the parameters supplied. If range values are given, then linear fogging is enabled in which no fog appears before start distance from the observer and 100% density is reached at end distance from the observer. If a density is given, then an exponential drop-off function is used as continuous from 0 to infinity.
#Set fog color to gray
viz.fogcolor(0.5,0.5,0.5)
#Use linear fog that start from 1 meter in front of the
user
#And at 10 meters in front of the user
viz.fog(1,10)
#Use exponential fog
viz.fog(0.2)