Page 1 of 1

Pulsating fog

Posted: Tue May 13, 2003 12:01 am
by Bjarne BZR
I just tested a piece of script I did to change the color and distance of the fogplane during the game... I found it rather cool. And because I'm such a nice guy, I'll share it with you guys:

Code: Select all

pulsating_fog:

	// Color settings
	local.farplane_color = "0.3 0.3 "
	local.blueshift = 0
	local.blueshift_max = 1
	local.blueshift_min = 0
	local.blueshift_step = 0.01

	// Depth settings
	local.fogplane = 5000
	local.fogplane_step = 40

	// Other stuff
	local.pulsate_speed = 0.1
	local.acending = 1

	// Actual code
	while ( 1 ) //for ever
	{
		// Switch pulse direction at max and min
		if ( local.blueshift < local.blueshift_min || local.blueshift > local.blueshift_max )
		{
			local.acending = ! local.acending
		}
		wait local.pulsate_speed
		if ( local.acending )
		{
			local.blueshift = local.blueshift + local.blueshift_step
			local.fogplane = local.fogplane + local.fogplane_step
		}
		else
		{
			local.blueshift = local.blueshift - local.blueshift_step
			local.fogplane = local.fogplane - local.fogplane_step
		}
		// Set the variables in $world
		$world farplane_color ( local.farplane_color + string local.blueshift )
		$world farplane local.fogplane
	}
end
The example fog pulsates between purple and "poison yellow", and rolls wildly back and forth... play with the variables at the start to calibrate it into someting that you can actually use :roll:

Just put it in your script and put the line:

Code: Select all

thread pulsating_fog
...in your main method to kick it into action...

Posted: Tue May 13, 2003 12:17 pm
by jv_map
8)

Posted: Tue May 13, 2003 12:43 pm
by Parts
I (sure I'm not alone) thought it would be great if you could randomise the light on a map. I had a quick look but it appeared settings like the amibent light, sun colour, direction, etc could not be changed in game. I presume these are set at compile time to improve performance.

Is this correct or does someone know better?

Posted: Tue May 13, 2003 1:20 pm
by Bjarne BZR
Yep, you are correct... the light settigs are compiled into the map... as it often takes several minutes up to a few hours to do the light compile, it would not be a good thing to demand a recompile every frame :? :D

Posted: Tue May 13, 2003 7:40 pm
by _Snake_
Just what I need to impress girls... :roll: 3 other people voted, I thought this would happen :)


But really, I am going to try this now. Sounds pretty cool :P