Toggling mist (or another solution?)

I was wondering if there is anyway to toggle mist? the render.enableMist isn’t a thing however render.disableMist is…
Otherwise if someone has a 2D filter for mist ? (so I can enable and disable the filter)

Is there any other way of adding and removing mist in real-time?

Thanks

Well, you could set the near and far distance of mist to beyond the viewable distance (like set both values to 500 or something) to disable it. I doubt it’d have any impact on speed. Setting the values back to a normal level (like 5-50) wold enable it.

I don’t know how well the render.mist setting work in Blender these days. Back in 2.49b you could only set world values such as mist distance or color by using the work around of deleting the world settings for the current scene in Blender and working with an empty “world” setting, otherwise it didn’t work.

If you have trouble with it you can try this trick (if it still works).

How about the note at the BGE API?

[/QUOTE]

Hmm tried this without success, tutorialsforblender3d suggests that the world setting of enabling mist won’t work, and to be able to change the depth you have to use python to enable the mist…which doesn’t exist because render.enableMist doesn’t work.

Thanks for the suggestion

how would you do this?
render.enableMist isn’t recognized or would you use this property to toggle it?

e.g. bge.render.disableMist(False)?

Thanks

As the note says, there is no “enableMist”. You set any other “mist” property (e.g. mist end) to enable it.

Remark: this is what the doc says. I never used that. So I can’t confirm.

edit: I just run a test with 2.70. This functions have no effect at my PC. It does not enable, disable or change the color of the mist while in game. It stays the same all the time.

Hmm still doesn’t seem to work:
I made a (not working) .blend to illustrate the issue the console doesn’t bring up any issues either, however maybe if someone wants to have a go at trying to get this working that would be greatly appreciated
Fog demo.blend (491 KB)

Note:

  • Blender 2.6x. Works with Shading: Singletexture and Multitexture.
  • Works with mist enabled using BGE python.
  • Doesn’t work with Mist enabled using the Blender Property Menu. Properties >> World button >> Mist tab
  • Set any of the mist properties to enable mist.

From Tutorials for Blender.

Only works with multi texture I’m afraid. I tested it thoroughly to make sure.
It used to work well in 2.49, I used single texture back then though so I don’t think it worked with GLSL back then either.

One way of doing mist in GLSL is to use the nodes, I’ve heard it can do quite nice mist, or you’re stuck with setting several world settings in different scenes (cloudy, misty, clear etc…) then use Libload to import your game scene in to that particular scene.

Works for me in BGE only through the world setting. Python looks completely ineffective…