Community Forum

setFog properties

Forum Overview >> Editor

CategoryEditor
Created15.03.2011 19:21


Bert Bkp (Bkp666) 15.03.2011 19:56
I tried adding some fog to my map like this:
http://img21.imageshack.us/i/98795833.jpg/
But there is no fog, and I tried changing the value in the "endDistance" from 0 to exp or exp2 and some fog appeared but the editor immediately crashed

Stefan Geiger - GIANTS Software 18.03.2011 15:55
The endDistance parameter needs to be a float number which specifies the distance where the fog will be 100%. This value is only used if the fogType is "linear". You are not allowed to set endDistance to exp or exp2, these values need to be set with the fogType parameter.

If you use the exp or exp2 type, then only the startDistanceOrDensity parameter is used, which in this case is a density. The higher this value, the denser your fog is.

setFog(string fogType, float startDistanceOrDensity, float endDistance, float r, float g, float b)

Bert Bkp (Bkp666) 18.03.2011 16:25
A float number means 1, 2, 3, 4 ..etc, right?
And if I understand when I put "linear" inside the "fogType" string, only the "endDistance" will be used.
I tried doing this, but no success, no fog to be seen

Stefan Geiger - GIANTS Software 21.03.2011 10:18
Float values are any numbers, include does with decimal places, e.g. 8.253.

If you use "linear" both the startDistanceOrDensity and the endDistance is used.
startDistanceOrDensity is the distance where the fog starts (e.g. up to this distance there is no fog at all) and endDistance is the distance where the fog reaches 100% density (e.g. you can see further than endDistance).

Using a startDistance of 0 normaly is ok.
So if you use something like this, it should work:

setFog("linear", 0, 100, 1,0,0)

This will give a red fog.

Note that you need to call setFog in the update function, as the very last call, since the BaseMission code already calls this every frame.

Bert Bkp (Bkp666) 21.03.2011 14:58
I don't really understand the last part with calling setFog in the update function

Bert Bkp (Bkp666) 23.03.2011 15:23
Oh you mean inside the .lua file under "function SampleModMap:update(dt)" Right?

Stefan Geiger - GIANTS Software 01.04.2011 09:56
Correct.

Bert Bkp (Bkp666) 01.04.2011 18:46
Thanks a lot man, I learnt something new :D


Note: Log in to post. Create a new account here.