Live progress #21 – Fog and performance

The biggest hit from the last weekend is an improved render, but lets maintain the order of events and start from top.

Firstly there was a lot of work on the water shader and overall rigging of it with the rest of the render pipeline. Water requires additional rendering pass over terrain with reflected camera to capture the reflections into a texture, that then gets projected on to a water surface. And since these are shaders, there’s also another trick in rendering the same terrain but clipping it to water areas to access waterbed depth – which means terrain gets rendered once again. Which did not fit well with inherited single-pass render. But it’s mostly solved now, with except for water areas setup (cover, height, waterbody properties). Beautifying water is another task altogether.

Then there was separation of atmosphere settings and addition of the fog into shaders:

2014-06-24 fog

Fog

Fog is a “cheap” effect, which games use mostly for 2 goals – hide the distant geomerty from rendering and to add a sense of distance to the world. In this render fog is specially made more dense and milky for now, later I will tune it to look more natural and don’t spoil much of the games colors.

Adding water and then fog to the game were the last straws – performance plummeted down to barely acceptable 19fps on a simple test map with 3 dozens of units and a bunch of houses by the lake. Weekend was spent on that problem. Solution was trivial – put the GPU to work and start using it for caching geometry. Results are impressive, ingame fps rocketed up to 119fps (more than x6 improvement!). There are bunch of thins left to cleanup, but overall I’m very satisfied with how it is going so far 🙂

This entry was posted in Live progress. Bookmark the permalink.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.