Hi there,
I recall there being a height parameter for Mist in the BGE. It doesn’t seem to be there any more. Am I just looking in the right place?
It’s been on my radar for a while to see how it worked? Would it be good for mist down a chasm? Alas… doesn’t seem to be there anymore.
If anyone has any suggestions, I would be eternally grateful.
M
I’m gonna guess you would make a box that represents your “boundary” of fog, and then have the alpha component of the fragment shader of the box be related to the Z value of the vertices. I’m not sure on the specifics, but it should be possible… I think.
You could also mess around with node shaders - people have gotten pretty powerful results out of them as well.
But I would probably go with the plane approach initially, since it’s easy to manage and set up. You could always edit it later if it proves to be an issue (e.g. for alpha-enabled objects).
I’ve gotten good results with node shaders, but there are definitely some limitations- blend in a color based on the Z-height of the material (or maybe use a lamp node to make it adjustable in-game). The hitch is those nodes would have to be on every material that can go into the mist, and its height would be global for the whole game world so planes might be better if you want the mist to be higher in places and lower in others.
The other catch with node shaders is if the camera goes into the mist the illusion breaks. With planes, there will be mist in front of the camera, whereas with nodes if the camera is in the mist looking out there won’t be any appearance of fog. However, given specific uses, node mist can look really good.