Mist color editable in RealTime(2.49b)

I don’t know if this already exist, but i have made a fake mist like Yo Frankie with material node, i’m using videoModule and Ipos to edit the fog in realTime.
You can change color and depth with property and/or Python script.
I’ve searched for long time a way to controll the mist, so i hope this be usefull.


Dynamic_Mist2.49b.blend (500 KB)

Ah, very nice ( and useful)!!
Thank you for sharing!

Indeed, very nice!
I could use this immediately if the color and distance changes in the script were dependent on properties and not on user input!
I’d like to give my own rules for color and distance changes!
Fantastic I was looking for a way to do this in a long time!

Welcome to the Forum.

This is really good, personally I think it would be best in concert kind of games. Or maybe for explosions even, like change the colour from smoky to yellow for a split second. Its great love it love YOU ok goodbye. :smiley:

Thank you !
Personnally, I’m working on a day/night system with this effect,
but it could be use to many other effects on shader,
because you can edit a value(dynamically) in material Node.

Hello guys!
I´m using another way to do that in Lucy and The Time Machine, i´m using a 2DFilter GLSL code:

uniform sampler2D bgl_DepthTexture;
uniform sampler2D bgl_RenderedTexture;
uniform float near;
uniform float far;
uniform float R;
uniform float G;
uniform float B;

vec2 texCoord = vec2(gl_TexCoord[0]).st;

const vec4 fogcolor = vec4(R,G,B,1.0);

void main(void)
vec4 fog =(2.0 * near) / (far + near - texture2D(bgl_DepthTexture,texCoord) * (far - near));

gl_FragColor.rgb = mix(texture2D(bgl_RenderedTexture,texCoord),fogcolor, fog).rgb;
gl_FragColor.a = 1.0;

By that properties in Logic Bricks and you can control the fog parameters:

The original code is by martinsh, i only did some changes to work it in ATI too and have more controls

Bye! :wink: