Optimizing Vegetation Rendering
THE GAME: Wargame: European Escalation is a real-time strategy game developed by Eugen Systems. Set in Europe during the 1970's Cold War, players command forces from either NATO or the Warsaw Pact and engage in historical battles and tactical campaigns.
Wargame delivers highly detailed, vivid graphics and offers a robust camera-zoom capability that moves from tight close-ups to miles-wide battlefield views.
THE CHALLENGE: Significant FPS drop when zooming into certain scenes. When zooming into battlefield scenes, frame rate was dropping significantly.
Using Intel GPA Frame Analyzer, it was determined that the grass fields were affecting performance because they were being rendered with constant density; that is, grass elements that were far away from the camera were drawn with the same number of draw calls as grass that was in close-up view. This resulted in a geometry/overdraw bottleneck.
Image 2: Improved performance using level of detail (LOD) implementation.
Two solutions were used to fix the issue.
SOLUTION 1: LOD (level of detail) implementation on grass rendering. LOD is the technique where the geometry of objects that are far away from the camera -- beyond what the eye can really see in any detail -- use a different rendering complexity than the geometry of objects that are in near-view.
Using the Intel GPA Frame Analyzer tool, Intel engineers were able to deep-dive into the hardware and discovered hardware inefficiencies when rendering the grass geometry. Eugen engineers applied LOD techniques to render the grass vegetation at different densities depending upon the distance from the viewer. They also optimized and simplified grass shaders for these distant chunks of grass fields and disabled Z-Write for these distant objects because it was faster and did not produce any visible artifacts.
SOLUTION 2: Shadow optimization. Shadow generation presents the user with an extra level of realism in top-tier games. However, engineers need to make tradeoffs between rendering time and the quality of the shadows.
Two distinct and complementary improvements were made, reducing the processing workload without sacrificing overall image quality. First, rendering performance was improved by shifting GPU processing -- which was heavy on pixel shader calculations -- towards better utilization of available vertex shader bandwidth. Second, shadow maps were limited to the rendering of objects that played a significant role in a scene, rather than the processing of shadows for pixel-sized objects that were too small for the human eye to recognize.
Image 3: Intel GPA frame analyzer identified opportunities for shadow optimization.
RESULT: Better than 2x increase in FPS. Frame rates for a sample frame that used these two solutions increased from 12.8 to 27.7 FPS.
Doing More per Draw Call
THE GAME: Civilization V is a critically acclaimed strategy game where players strive to become Ruler of the World by establishing and leading a civilization over thousands of years. Developed by Firaxis Games, Civilization V, the fifth in the award-winning series, uses a new game engine and delivers highly detailed, graphically rich visuals that fully immerse players as they wage war, conduct diplomacy, and build nations.
THE CHALLENGE: Increasing performance to support a great user touch experience. While optimizing Civilization V for PC "touch" capability, response times were a sluggish 16 FPS in the worst performing section of the game, far slower than what is needed for a compelling gaming experience. Using Intel GPA Frame Analyzer, it was quickly uncovered that frames were using up to 10,000 draw calls -- a very high number.
Using GPA, Firaxis developers and Intel engineers could tell that each object was rendered as its own individual draw call. For example, if a frame had 12 objects -- buildings, soldiers, trees, etc. -- that were the same type and model, each object instance was rendered as a separate draw call. Furthermore, they could tell from GPA that these objects shared the same materials, which helped in moving through the solution phase.
Image 4: Civilization V scene showing multiple objects with the same geometry and materials. Each was originally rendered as its own individual draw call.
Game performance was CPU bound, which was swamped in processing 10,000 draw calls per frame. Because the CPU could not "feed" the GPU fast enough, frame rates were exceptionally low.
THE SOLUTION: Instancing to overcome excessive overhead. Instancing is the process of reducing draw calls by drawing multiple objects with the same geometry and materials -- i.e., the repeated buildings, soldiers, or trees -- in a single draw call. It can be done with objects that use the same mesh, even if they're positioned slightly differently in the scene. The continued use of GPA throughout the instancing phase showed what could and couldn't be instanced. That was done by inspecting the draw calls for similar materials and shaders.
Seeing immediate performance gains in initial experiments, Firaxis used instancing throughout the game to collapse similar models and textures into one draw call.
Image 5: Instancing: before and after. Draw calls were reduced 3x, from 10,000 to 3,000.
THE RESULT: Over 3x reduction in draw calls and 2.5x FPS increase. Draw calls were reduced from 10,000 to 3,000 per frame. Frame rates saw a 2.5x improvement, increasing from 16 to 40 FPS.
Given the expanding platforms and capabilities of gaming devices, performance optimization will always be a top priority. Whether you're an indy developer or a large game house, Intel® GPA can help you analyze and optimize your games, and make them run faster, faster.
Download the latest version of Intel® GPA FREE. Visit intel.com/software/gpa.
How is the Intel Graphics Performance Analyzers toolset different from other development tools?