Game Development Community

Changing ambient light level when entering a zone

by Richard Marrevee · in Torque 3D Professional · 05/02/2010 (6:03 am) · 4 replies

Just a stupid question, but I can't find the answer anywhere. I have setup a dungeon with an entrance at terrain level, then added a Zone which completely covers the underground part of the structure and put a Portal at the entrance.

Now I would like to set the ambient light level inside the dungeon to be much lower then outside, but the question is: how can I do that?

Is there anybody who can help me.

Thanks

About the author

Started programming in 1984 on an Oric, when time progressed switched to MSX, Amiga and finally the Windows PC with T3D. Now developing an epic fantasy game: The Master's Eye. Creator of the DoorClass pack and VolumetricFog pack @ richardsgamestudio.com


#1
05/03/2010 (7:04 am)
If you are using a ScatterSky, named "scatSky":

scatSky.exposure = <value>;  // e.g. 0.3
scatSky.applyChanges();

If you are using a Sun, named "theSun":

theSun.ambient = <value>;    // e.g. "0.2 0.2 0.2 1"
theSun.apply();

You probably want the transition from outside ambient to inside ambient to be smooth, rather than a sudden change. To accomplish that you might setup a trigger starting at the entrance and extended down the tunnel to the dungeon. On each trigger tick you could look at the player's position to see how far down the tunnel they are and set the ambient to the linear interpolation between full outside and full inside ambient based upon that position.
#2
05/03/2010 (9:24 am)
Wouldn't that affect the entire level? Since the mission is actaully loaded on the server and sent to the clients you would have to make that call server side if I remember correctly. That would cause the ambient to change for all clients.
#3
05/03/2010 (1:39 pm)
@Ryan Mounts:
Thanks. It worked. I only had to set the TimeOfDay to not playing, and due to the twisting and turning of my dungeon I had to set up different triggers with different levels.

@Ryan Mick:
I think you are right. but for me it works (singleplayer). Btw nice cat, looks like mine.
#4
05/04/2010 (9:21 am)
Thanks, she is a 20 pound Mainecoon. She is almost 3 feet long from the tip of nose to the base of her tail. After having a Mainecoon I will never have another type of cat, they are great.