Fog


(WeeBull) #1

I don’t know if it’s possible, but this is what I want.
I want fog in my map, but you should be able to turn it off with a button or something. I know how to make that, but my problem is that the fog doesn’t go off. Here’s what I did.
I made a big brush around my map and gave it a fog texture, I made it a script_mover with scriptname: fog and targetname: fog. The fog shows up perfectly in the map, but then I put this in my script:

fog
{
	spawn
	{
		wait 50
		setstate fog invisible
	}
}

Just to test if I could setstate it invisible, but it didn’t work. (With g_scriptdebug I’ve seen that it is being triggered.)
I looked through the LDR now and I found this:

setglobalfog <bool:restore> <int:duration> [float:r] [float:g] [float:b] [float:depthForOpaque] 
Changes the global fog in a map. 

So I deleted the fog brush and put this in the game_manager spawn event:

setglobalfog 615 .30 .001 800
wait 5000
setglobalfog 0 0 0 0

Just to test if it would actually change, but when I tried to play the map I got this error:

MatchToken: .001 != (

WTF!?

So how do I actually use this ‘setglobalfog’ command and would it work? Or does someone know how to do it on another way.

Thanks in advance.


(cookie_box) #2

sry, m8 id whis i could helped you but i dont even know how to make fog :stuck_out_tongue: trying the hardest i can thoug :stuck_out_tongue:


(]UBC[ McNite) #3

Why do you want to make your fog disappear? Sounds pretty wierd as an idea tbh.


(nUllSkillZ) #4

May be it isn’t working at all.
But it seems that you have’t got all parameters.
Not sure of the bool:restore.
Could be 0|1 or yes|no or on|off.
Second parameter is duration (in ms I guess) followed by the amount of red, green, blue and “alpha”
So the line have to be something like:


setglobalfog 1 2000 0.8 0.8 0.8 0.6


(Jaquboss) #5

note you might try remapshader with volume fog


(WeeBull) #6

[quote=]UBC[ McNite]
Why do you want to make your fog disappear? Sounds pretty wierd as an idea tbh.
[/quote]
Yeah it does sound weird, but I’m making a deathmatch map for a clan that really wanted one (and I was bored so why not). But a normal map without fog can be boring so I thought, if you want a more challenging duel, you can just press a button or something and the fog appears to make it harder to see eachother.

nUllSkillZ and Jaquboss, I’ll try both your ideas, thanks for the help. I’ll let you know if anything works.

Edit:

Both didn’t work.
When I did this:

setglobalfog 1 100 0.615 0.309 0 0.5
wait 5000
setglobalfog 1 1500 0.2 0.1 0.6 0.5

(Just some random number) My ET simply crashed after the 5 seconds of waiting. And there was no fog at all.

And when I did this (in game_manager spawn event):

wait 5000
remapshader textures/1equals1/yellow_fog textures/1equals1/yellow_fog2
remapshaderflush

With these shaders:

textures/1equals1/yellow_fog
{
	qer_editorimage textures/common/clipmonster.tga
	qer_trans 	0.3
	surfaceparm	trans
	surfaceparm	nonsolid
	surfaceparm	fog
	surfaceparm	nolightmap

	fogparms ( .615 .309 0 ) 800
}

textures/1equals1/yellow_fog2
{
	qer_editorimage textures/common/clipmonster.tga
	qer_trans 	0.3
	surfaceparm	trans
	surfaceparm	nonsolid
	surfaceparm	fog
	surfaceparm	nolightmap

	fogparms ( .3 .7 .4 ) 1500
}

Nothing happened after the 5 seconds of waiting. I made a brush with the first shader in the map and that fog worked fine, but nothing changed after 5 seconds and with g_scriptdebug I’ve seen that it does get triggered.

Did I do something wrong or is there another way or is it simply not possible.
Thanks


(]UBC[ McNite) #7

Well I think that you just can’t override or change the fogparms parameter. The last number defines the distance at which the fog becomes opaque, and for my money that parameter is probably not subject to change on runtime.

(A possible reason for this is maybe because fog usually gets used together with a farplanedist which even has an impact on the VIS-tree. To have the option to mess with the opaquictiy parameter while using farplanedist just makes no sense.)

Since it probably is just a small arena, you could try some layers of semi-transparent brushes, because you don’t have to worry about framerates. I know they don’t look as smooth, but they would work with setstates.


(leifhv) #8

Not sure if this command actually works, but from a quick look at the source it seems like the syntax for this command is either:


setglobalfog 0 2000 0.8 0.8 0.8 0.6
//or
setglobalfog 1 2000

So if you have 1 as the first parameter you should not include the parameters after duration.

I think ‘setglobalfog 0’ means change fog as specified and ‘setglobalfog 1’ means restore it to ‘no fog’ (?). The duration parameters might be related to how fast the change should be made where 0 is an instant change…?


(WeeBull) #9

That sounds obvious, I’ll give it a try.


(WeeBull) #10

Ok, it seems like you can’t create fog with the ‘setglobalfog’ command if there isn’t any fog already in the map. But I got a bit closer, here’s what I did.
In the wordspawn of my map I set a key/value pair of _fog / textures/1equals1/yellow_fog, the fog showed up in game. Then I used this script in the game_manager spawn event:

wait 5000
setglobalfog 1 2500

The fog dissappeared, but I still couldn’t see the entire map, I could see 'till about 800 units and everything behind that was just white. I’m affraid it isn’t possible and I’m not gonna try ]UBC[ McNite’s method because I don’t think that will look nice.
I’m gonna try one more thing, move the fog brush out of the map very fast :stuck_out_tongue: .


(leifhv) #11

Yes, that behaviour seems logical…the visibility won’t be affected by the removal of the fog since that part i calculated when you compile the map. Using a long viewdistance for the fog (farplanedist ?) will work I guess but then there isn’t much point in using fog in the first place.

Still, this can still be used for changing the colour and density of the fog during runtime which might make for an interesting effect?


(WeeBull) #12

Changing the farplanedist to a high value didn’t work, things were still not drawn after 800 units (which i set in the shader). And moving the brush away very fast didn’t work either, there wasn’t any fog but I saw the brush moving and after a second or so ET crashed, might be something I did wrong, but it doesn’t matter 'cuz you don’t see the fog anyway.
I guess it’s bye bye to my plan :frowning: .


(leifhv) #13

Yeah, see this thread http://www.splashdamage.com/index.php?name=pnPHPbb2&file=viewtopic&t=14966 or one of the other fog threads. You must adjust the fogclip value also I should think.


(WeeBull) #14

Changing fogclip too didn’t work either so I guess it’s not possible. Thanks for the help anyway.


(carnage) #15

cant remeber the command but instead of moving the fog brush fast isnt there a command that just instantly moves it from one point to the next

also your other problems definatly sound like something to do with farplane. perhaps the map keep the farplace distance of the first fog it uses. even after it changes the fog. perhaps you could use a fog shader with a farplace far beyond the limits of your map then at startup change to the fog you want to actuly use. then change this to the no fog shader to make it disapear


(kamikazee) #16

Taken from Chruker’s excellent scripting reference:

setposition <targetname>
Moves entity to position of target entity.

Much better then moving it “fast”.


(WeeBull) #17

I’m definately gonna try those suggestions, but it won’t be today nor any day in five weeks from now because I’m going on a holiday for five weeks tommorow to Australia. I hope I won’t forget about this :stuck_out_tongue: .