Tuesday 14 May 2013

Tuesday LOD Thoughts

The World Of The Small and Distant

My work on the Character prototype with respect to LOD rendering naturally lead me back onto the subject of LOD for the static system I currently have. I must have played and replaying the current prototype for 2 hours, wrecking my brain  to come up with a system that would allow me to reduce the ENTIRE view of 80x80x20 tiles to a polygon count and draw count that would run fast enough for the editor. Today I cracked it.

The Massive Level LOD Technique

Using the same concept as the current design, at the same time meshes are added to buffers to create shapes that need rendering, my new system will eventually add LOW LOD polygons to a a series of LOD buffers that overlay the existing level. These LOD buffers will be three times the special size of the current buffers but contain few polygons per tile to avoid overloading them. As they will almost always be rendered in the distance, and draw calls become the bottleneck at this point, having buffers 9x9x1 should not be a problem. I am keeping the vertical slices to one layer per buffer as when editing from top-down, I want to be able to pop the entire layer up and down a LOD level as I move closer and further away. I ran some numbers, and it looks like I can keep within the 1600 draw calls no matter where you look down on the level map.

By creating the LOD buffers alongside the main buffers, the performance speed for transitioning between the two will be instantaneous  and I only need to transition to LOW LOD when all nine regular buffers that represent it are outside of the range at which polygons pop into high quality.  Adding the mesh data to the buffer will also not hit performance as it has become clear the bottleneck at high altitude is simply draw calls per cycle.

Many LOD Challenges

There are a few bruisers still to solve though, not least of which that every texture and shader will require it's own buffer (or a system to render subsets from within the buffer using different textures). Alternatively, a new texture map can be built dynamically as the LOD buffer is created, that steals texture data from the real texture. I effectively create a patchwork quilt of small textures which means the buffer can be drawn once and all the textures would be visible in the distance in one go.  More experiments are required to see if creating these textures would be too much of a hit, but I suspect I can do them in a thread so the textures are gradually refined as you move through the level.

Another challenge is to watch out the extra weight of additional LOD polygons does not creep the memory usage back up to former levels.  No sense doing all this work only to have the same problem from another direction :)

The result of all this work will be an engine that only renders high quality geometry where it's needed, and then paints broad strokes for the rest of the distant scene. This will show best when it comes to performance, and those users concerned about what graphics cards they have will be pleased that LOD is being built into the core of this new technique.


Prototyping these new LOD ideas will be my task for the remainder of this week, with the aim of allowing me to populate an entire level with segments of various polygon counts, and roaming around it from a top view and first person view without the frame rate dropping below 100fps (on my PC that is). This will establish that we have managed to cram everything we wanted into the memory whilst allowing a very fast scene system to render effortlessly.  Only once these challenges are met shall I move back to adding light mapping data to the meshes, and modify the DarkLIGHTS module to integrate with this new system.


Signing Off

As you may have gleamed in a previous blog reference, my quest to buy a replacement car (for meetings and suchlike) has finally come to an end and I have now made my purchase.  I was going to buy a real ropey (but cheap) car but I had a chat with my mechanic friend and he advised me to walk (er, run) away from it.  I have settled for something a little more reliable for those long motorway journeys. Be prepared for a much delayed Wednesday's blog as I have chosen that day to go collect the offending vehicle and put some serious motorway miles on it.  Let's call it vehicle physics research in case the stretch goals for Reloaded extend that far ;)

As a summary until the next blog, really happy to have the opportunity to go through the lowest components of the engine and improve things. We know what we want from a next gen FPSC, and I agree we should aim really really high this time!

1 comment:

  1. Glad to know that FPSC:R is going to be awesome and finally nextgen-ish

    ReplyDelete