Hi ! I making a game where I can't restrain the camera controls, so the player is totaly free. And I need to make a fog of war, but if I do a simple black plane as normaly it's just horrible, because when you loop up you see the elevations !
Here is the original game : The little cube with a with light onto it is a boat (Normaly there is about 4-5 boats), and the Simbad is its target, so he travels on the sea to get it.
And the result I would like, a total black zone for the "terrain" where you never traveled, a grey transparent zone where you already traveled, and a clear zone where you already traveled.
So here is my idea (a copy of the plane solution):
I generate a mesh wish take the shape of the terrain and the sea (NEGATIVE-Y raycasting), and then I use a texture where I save the pass of my boats into a dynamic texture (grey already explored, white current zone, black unexplored). And then in the fragment shader of the terrain shade, I would look in the texture if the pixel is black, totaly transparent or half transparent.
Then to don't have all the terrain shape, I would setup a minimum Y, so you will only see the mountains and others elevations.
Any better idea? My fear is that it would be a performance killer .
Thanks for your help.
Fog of war with free camera
-
- OGRE Expert User
- Posts: 1119
- Joined: Sat Jan 01, 2011 7:57 pm
- x 216
Re: Fog of war with free camera
You could use projective texturing on all your materials to properly project the (2D) fog of war texture onto the 3D environment in a top-down fashion.
- shocoben
- Gnoblar
- Posts: 5
- Joined: Fri Feb 07, 2014 11:54 pm
Re: Fog of war with free camera
Shouldn't have I to rewrite all my materials if I use this technique? Can't I apply something like a second material which would works like a post processing?scrawl wrote:You could use projective texturing on all your materials to properly project the (2D) fog of war texture onto the 3D environment in a top-down fashion.
-
- Gnoblar
- Posts: 10
- Joined: Tue Jan 28, 2014 3:30 am
Re: Fog of war with free camera
Lighting visibility flags?
-
- OGRE Expert User
- Posts: 1119
- Joined: Sat Jan 01, 2011 7:57 pm
- x 216
Re: Fog of war with free camera
Yes you'd need to do this on all materials. But you can use a template material and derive your materials from that, that way you don't have any redundancy at least.Shouldn't have I to rewrite all my materials if I use this technique?
You can do this in post-processing, but that would require saving the depth or xy position values of the framebuffer into an extra render target, you would basically need to render your scene twice (or use an MRT), but either way that is much slower.Can't I apply something like a second material which would works like a post processing?