Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    235
  • comments
    509
  • views
    172385

Fade Away

Sign in to follow this  
SimmerD

107 views

Fade Away

Just got back from seeing my folks, and I installed the game on their PC. It ran at 58 fps on a 2.6 ghz, 1gb ram and a gf 6200 128 ( non-turbocache ). It was interesting watching my dad fight with the controls. He's not into games much anymore, so it was instructive to see how someone not used to FPS games played with the control system.

While on the trip I had several good ideas, and found a better way to do fade-outs.

One thing we'd been thinking of doing for a while is having the scene sort of fade away at the edges. Essentially like ranged fog from the player's perspective, instead of the camera's. I began implementing this today, and so far, so good.

I take a round falloff texture and map it so that its center falls on the player location. Right now I'm doing the fade-out in a purely circular fashion, rather than a true 3d falloff. I may change this in the future, but so far, so good. I'm not using a straight 1-d^2 type falloff, but rather 1-d^7 or so, with clamping to 1.0, so that the fading only occurs at the very edge of the viewable area.

This first version of the effect fades to black only. It was interesting trying different fade out methods. The first I tried last Wednesday or Thursday was to fade out the lights themselves to black when the player was far from them. This was clearly not the right effect, due to the non-linear attenuation encoded in the light occlusion maps. It was obvious that the lights were brightening as the player neared.

Here is a shot that exaggerates the fading out, so that everything beyond 10 meters from the player fades to black.



This obviously didn't effect the ambient, so I added the circular falloff texture to the ambient pass. This did fade unlit things out properly, but not lit parts of the world.

Then I changed it so that I fade the diffuse texture out when setting up the deferred diffuse texture. This had the desired effect, and also equally fades out ambient and other lights, since all lighting in AG is eventually modulated by the diffuse/gloss texture.

Once fading the black works, the next step is to add an optional fade to color. This will be accomplished by re-rendering the relevant parts of the scene with the fade texture & the fog color.

Each level can fade out or not, and if so, has a fade scale, a fade texture, as well as a fade color. For outdoor levels, I expect this to most likely match the skybox horizon color, but perhaps a desert level would fade to a sandy brown.

Here are two more shots of the effect, with the fade distance changed to 25 meters, so just the edges of the screen fade out.





One side benefit of this glorified depth cueing is that it will allow the engine to more aggressively cull lights, shadows, decals, entities and particles not in view. I will make an AABB around the player of 2 * fade_distance in width and depth,
and use that for an additional culling step. No point drawing invisible things, right?

Tomorrow I will add fading out decals, particles, entities and liquids as well.
Sign in to follow this  


4 Comments


Recommended Comments

(Please excuse my lack of knowledge on deferred shading!)

Is your final rendering pass the same for all materials? If so, then to add the fade effect (which looks REALLY good imho), you simply modified your final combining pass to modulate the diffuse G-Buffer color by the lookup value in the falloff texture?

I guess that is one of the good things about deferred shading - I can't think of a way to add this type of a fade effect to a forward renderer. Any ideas?

Share this comment


Link to comment
Thanks for the compliments.

That's not quite how it works. There isn't a final rendering pass, because I am adding lights in separate passes.

So, I fade out the 'G-buffer' color term itself, and also the gloss term, so the specular fades out as well. I'm not doing a g-buffer in the sense that I don't store depth or xyz in my semi-deferred renderer system.

I don't bother fading the normal map, because it's not needed.

Share this comment


Link to comment
An "overbright" or "overexposure" fade-out effect would be pretty cool. Start losing all of the colour values as it all goes to white.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!