
Fog in Atmosphere is not really "fog". It's more a disease of the eyes of the player :-)
It's like a "box" transparent, glued in the player's eyes, The thickness of the walls of the box is the diference between:far and near, properties of the Fog class . The level of transparency decrease from near to far.
The reference for the Fog class is:
fog.active = boolean If boolean is true: we have fog!
fog.dropOff = n The fog drop-off style
(0=hard; 1=linear; 2=1/Z-squared)
fog.near = n How close the fog starts
fog.far = n How far you can see through the fog
fog.color = [ r, g, b] The color Vector of the fog
We can use "fog" to create the ilusion of time, changing the color of the fog.
The code :
hour=5;
fog.active=true;
fog.near=50;
fog.far=1500;
t=0;
timestep=function() {
if(t==20){
t=0;
hour++;
if(hour==24) hour=0;
}
if(hour==0) fog.color = [.0, .0, .3];
if(hour==1) fog.color = [.0, .0, .3];
if(hour==2) fog.color = [.0, .0, .3];
if(hour==3) fog.color = [.3, .35, .5];
if(hour==4) fog.color = [.4, .35, .6];
if(hour==5) fog.color = [.5, .35, .8];
if(hour==6) fog.color = [.6, .8, .8];
if(hour==7) fog.color = [.7, .8, .8];
if(hour==8) fog.color = [.7, .8, .8];
if(hour==9) fog.color = [.7, .8, .8];
if(hour==10) fog.color = [.7, .8, .8];
if(hour==11) fog.color = [.6, .8, .8];
if(hour==12) fog.color = [.5, .8, .8];
if(hour==13) fog.color = [.5, .8, .8];
if(hour==14) fog.color = [.5, .7, .8];
if(hour==15) fog.color = [.5, .7, .8];
if(hour==16) fog.color = [.5, .6, .7];
if(hour==17) fog.color = [.5, .6, .7];
if(hour==18) fog.color = [.6, .6, .7];
if(hour==19) fog.color = [.5, .5, .6];
if(hour==20) fog.color = [.5, .5, .6];
if(hour==21) fog.color = [.3, .35,.5];
if(hour==22) fog.color = [.0, .0, .3];
if(hour==23) fog.color = [.0, .0, .3];
t++;
}
And the demo:
PREVIOUS LESSON NEXT LESSON T. CONTENTS HOMEPAGE
