Game Development Community

3D Fog of war

by Robert Rose · in Torque Game Engine Advanced · 11/22/2007 (1:55 pm) · 2 replies

Hey folks, I haven't given this much serious thought yet, but it's turkey day and I'm in front of the computer so I thought I'd pose this question to the community..

Does anyone have any suggestions for how to implement a 3D fog of war effect in TGEA?

Picture a wide angle orbiting camera (or "god camera"). I'm interested in doing something where each player on a team can only see some distance X feet in front of them, but players can also see what their team members can see... like an RTS. But unlike your typical RTS I want the effect to work at any imaginable camera angle (including first person). Static terrain in the FoW should still be visible, but darker.

Some thoughts:

I could break the world up into a grid, determine the visible cells each frame, collect adjacenent cells and then render a poly over non-visible cells, selecting texture uvs so there's a nice alpha-fade out on the edges.

The TGEA demo talks about "volumetric fog", is that system capable of doing an effect like this? Can I pass it a giant list of aabb's and it'll take care of it?

Is there a clever stencil mapping trick in here? Could I two-pass render the scene, first the visible set, create a mask from the visible set, and then render the non-visible set using that mask and greyed out? Part of the problem tho is there's terrain that I want to be partially visible.. I don't want a hard edge on the FoW, but a soft edge that alpha-fades out...

Thoughts? Ideas?

#1
11/22/2007 (2:40 pm)
Simplest way: use the fullscreen resource (CanvasFX).
If you search for it you will find its thread and even a shader that might give you what you want :)


And no, the volumetric fog is the same as TGEs, its only a height based fog bank. Nothing else.
#2
11/22/2007 (5:17 pm)
Maybe this will help:


full screen fx thread