Ground Fog

Ground Fog

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Ground Fog

Post by trepan »

Notes:
- requires GL 2.0 (for the shaders)
- requires 24-bit depth buffer
(it uses the depth + camera pos + pixel direction to extract the world space coords)

Forboding Angel's EE-RiverGlade-v02 map:
Image

P.S. I'll release it in LuaGaia form once I've cleaned it up some. I'm not really
sure that I'd ever want to play with it on though, doesn't really add all that much
for me.

P.P.S. The following parameters are easily changed:
- fog height
- fog attenuation
- fog color
There are plenty of variations on the current fog setup that could be coded.
Actually, there are a number of other interesting effects that can be done once
the pixel world coordinates are extracted. Here's a screenshot of my debug
mode for world space coords (3D grid @ 100 springthings):
http://trepan.bzflag.bz/spring/jpg/depthdebug.jpg
Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Post by Warlord Zsinj »

I hear sigourney weaver for a sequel; 'kroggies in the mist...'

I want to see this on aGorm's tree map :)
User avatar
Felix the Cat
Posts: 2383
Joined: 15 Jun 2005, 17:30

Post by Felix the Cat »

-Could a user (modder/mapper) change it to produce localized fog effects? Would be cool on certain maps, maybe fog over the water on a land/water map or fog in the woods or something. Would be cool with certain mods, having smoke accumulate when artillery fires or there's a big battle and lots of wreckage would be pure pwn.

-What's the framerate hit for this?
--If it's a lot (equivalent to large amounts of smoke), probably not very useful for a couple of years, until computers can generally handle it.
--If it isn't a lot, this might be an awesome replacement for some smoke effects with some changes to the code - obviously it wouldn't look as good as current smoke but it might be a settings option for people with lower-spec computers.
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan »

Nvidia 7900GS
water disabled
shadows enabled

ground fog enabled= 69 fps
ground fog disabled = 70 fps

test view:
http://trepan.bzflag.bz/spring/jpg/fogfps.jpg
User avatar
Felix the Cat
Posts: 2383
Joined: 15 Jun 2005, 17:30

Post by Felix the Cat »

Nice!
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan »

Haven't played with it much, but it's almost good enough.
Might throw in some fog variation:

http://trepan.bzflag.bz/spring/jpg/more-gnd-fog.jpg
Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Post by Warlord Zsinj »

It's very sexy.

I wonder if there's a way to have friendly units render above the fog - or render as outlines around the fog (many RTS's have something similar), so that you are still able to see and control your forces reasonably easily, though the enemy forces are still obscured.

Would also be helpful for those dense foliage maps like aGorm's tree map, as well as the planned urban maps that a few people are working on.
User avatar
TechnoTone
Posts: 165
Joined: 23 Aug 2005, 22:02

Post by TechnoTone »

I imagine the XRay Shader widget would do that.
Tim-the-maniac
Posts: 250
Joined: 22 Jul 2006, 19:58

Post by Tim-the-maniac »

http://trepan.bzflag.bz/spring/jpg/more-gnd-fog.jpg : needs to go on screenshots page imo :)
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan »

Warlord Zsinj
Already covered, the test widget is setup so that it can render in
either the DrawWorld() pass or the DrawScreenEffects() pass
(at the beginning of the passes).

TechnoTone
Yup, xray shows through nicely, when using the DrawWord() pass.

Tim-the-maniac
Thanks, but I'm sure I could come up with a better screenshot that
had dynamic water and some units in it ;-)

Current fog flaws:
- translucent explosions are not rendered properly (could use explicit
fog coords to render them properly, but then the same goes for the
terrain and unit rendering as well, although it wouldn't be done per-
pixel as my shader trick does). Could also add a lua projectile shader.
- dualscreen mode does not work (at least not when the minimap
is on the left).
BoredJoe
Posts: 139
Joined: 03 Mar 2006, 01:37

Post by BoredJoe »

Could you combine this with LOS so that the fog thickness gets thicker with distance?
User avatar
MadRat
Posts: 532
Joined: 24 Oct 2006, 13:45

Re:

Post by MadRat »

BoredJoe wrote:Could you combine this with LOS so that the fog thickness gets thicker with distance?
If you could integrate the fog effects as a wall for concealing unexplored territory then it would put a whole new meaning to "fog of war".
Post Reply

Return to “Lua Scripts”