Water optimization


photo

Recommended Posts

I have some suggestions for ObjectWater performance optimization. Actually, even highly-optimized Oil Rush game should greatly benefit of those changes cause users would appreciate FPS increase in naval scenes.

 

1. When water is not visible - hide it

It sounds weird but that is a fact: water object in scene eats 10-15% FPS regardless of visibility and occlusion queries. Disabling dynamic reflection can be used instead of hiding whole object - it have the same performance impact.

In our project we use simple 2d height map and some kind of checks for view frustum intersection with zero-level zones and reflection is disabled if there are no such intersections. Even this clumsy implementation gives great result - 70 FPS instead of 60 on islands and continents that is ~16% increase.

 

Conclusion: improved visibility queries are needed for water-less locations.

 

2. Improve LOD usage for reflection (distance checks for reflected objects, skip terrain detail maps, etc.)

I made a lot of tests and it seems like reflection uses lower (closer) LODs than regular view. I.e. in lake scene (screens below) disabling reflection for tree branches and clutter objects improved FPS by 10% and decreased overall polycount by 100k (!!) with no picture changes. After spending a day tweaking all models I finally was able to choose which LODs are reflectable and which are not, achieving significant FPS boost. Profiler screenshots are attached. Here we have improvement from 42 to 50 fps that means about 20% with no visual changes and with 216k polygon improvement. Also terrain reflection is rendered using material textures while it can just use coarse diffuse maps with exactly the same result.

 

post-26-0-55453200-1317892247_thumb.png post-26-0-88356400-1317892315_thumb.png

 

Conclusion: water reflection can be tweaked to skip clutter/distant objects and terrain detail maps.

 

3. Implement simplified pseudo-dynamic reflection

Dynamic water reflections are great but if user's hardware is relatively weak we have almost no fallback - static reflections looked ugly for me until I found that we can grab an environment cube map from current location and assign it to reflection texture slot. It is not as precise and should be re-calculated with camera position change but it is much cheaper.

 

post-26-0-81297500-1317892594_thumb.png post-26-0-97241500-1317892511_thumb.png

 

In above sample static reflection is not 100% realistic but it 'reflects' all objects on the coast and gives 21% FPS boost. Unfortunately, grabbing environment 3d maps is really slow so we can't use that system in production, but I'm pretty sure it is possible to use some kind of data from previous frame buffer for simple 2d reflection map.

 

 

Conclusion: cheap 'mirror' reflection would greatly increase performance on low-end hardware.

 

--

WBR, Alexei

Link to post