Mist Changing In Realtime Via Python

Hey all!

Just need some insight on if changing mist levels and colors in realtime?
I mean literally realtime, saluk and I have tried it both and i suppose we’re not doing something right. Can someone help



What’s the Problem?

Our script that used the setMistStart(), setMistEnd(), and setMistColor() commands seemed to have no effect. Is there something we’re missing?

I’ve never used Mist before. I try that.

All working fine for me. I do not use any World-Setting or something, just the following Script:

import Rasterizer as Ras
Ras.setMistColor([0.5, 0.5, 0.5])

# For the Color, use the Values like in the Paint Buttons

I hope that helps :smiley:

if you want those to work, make sure to NOT have mist in the world window

Hehe, thats the problem. We have mist set up in the world window:)

Thanks a bunch!


when the heck is your network gonna be up???


As soon as I can buy a new network card and hub. In a day or two.

so with that dynamic setting of mist, it is possible for almost volumetric mist. So it can set mist based on orientation and position. The math would be quite simple too yes?

However, am i right in assuming that the setting for mist that effects its falloff doesn’t apply to real time - as in the thickness of the mist based on height.


wow. volumetric mist around dynamic water! how about that! :slight_smile:

You’re right, that could happen! But, it’s not truly volumetric, because the mist always covers the entire screen. Still could be a cool effect though.

Apparently, i have to have no world settings at all to make it work… Or did i miss something???


Yep, that’s correct. You have to delete the world settings if you have them (for the scenes that need dynamic mist)

You can also change gravity which could be fun:)

I tried the mist script, but have some questions about it. The script for mist does only covers only meshes and object, but I hasn’t got volume. How to get this like the real mist when adding a world setting. Add height in the script? like Ras. setMistHeight(50) or something? :-?

There is no real mist volume, as it is not volumetric mist, merely simple fog.

I’m not sure about height.

Saluk’s right, the fog is not volumetric and you can’t set the height only distence and density… :frowning:

:frowning: that’s bad. But is there a way to animate mist in the game engine? Because I though this was a begin, so it isn’t. Do I have to use ipo to animate mist? :-?

You can fake animating the mist with a python script by changing the mist settings gradually…

Ok, so it’s possible :smiley: great. But the problm is, which script do I have to use to fake animate it? Or does some make this script already?

I have a little question, How could I do this. Setting up mist in world settings, then choose the color orange, then use python script to chance the mist color in the game engine afther 10 seconds in to dark blue? I don’t know which kind of script I have to use, I’m a noob a python and I figured it out in some months and still don’t know how to do this. :x So could someone help me, I want to set up a sort of day and night function in a game using mist. :smiley: