View Single Post
  #2  
Old June 15th 11, 08:19 PM posted to alt.comp.periphs.videocards.nvidia,comp.games.development.design,comp.graphics.algorithms,comp.graphics.api.opengl,microsoft.public.directx.graphics
Wolfgang Draxinger
external usenet poster
 
Posts: 13
Default Under water for Battlefield 3.

On Wed, 15 Jun 2011 20:56:19 +0200
"Skybuck Flying" wrote:

So if you know of any good under water graphics algorithms post them
here ! =D


Sure, just render things as usual and apply an exponential fog
falloff. Seriously, rendering underwater scenes is boring.

What's interesting is rendering boundary surfaces between volumina of
different optical density. That's where things become
interesting, however it's not terribly difficult:

1. Render the underwater scene like usual (apply exponential fog for
absorption of light), but refract the viewing frustum boundary vectors
and use a texture as target.

2. Render the scene over water mirrored in the water surface, again
target a texture.

3. Create a boundary surface. In the case of water you'll want waves.
Simulating realistic looking waves is the hardest parts, but there are
several methods (Google "realtime low viscosity wave and ripple
simulation"). Usually you'll go for some fourier transform based method.

4. Use the wave normal map to distort the underwater and reflection
textures, today one does this using a fragment shader. Mix the textures
by applying a Fresnel term. If you want to spice things up apply a
slightly stronger distortion on the blue and a slightly weaker on the
red channel to account for chromatic abberation.

Really, totally boring stuff if you've done it often enough. It was new
around 2003 when programmable GPUs hit the market. I actually did this
kind of stuff using a fixed function pipeline GeForce2 some years
earlier, but it required several rendering passes.

What's a lot harder than water and refractions is realtime indirect
lighting. And good lighting is what makes a scene looking nonartificial.


Wolfgang