Our Properties: Gamasutra GameCareerGuide IndieGames Indie Royale GDC IGF Game Developer Magazine GAO
My Message close
Contents
Sponsored Feature: Rendering Grass with Instancing in DirectX 10
 
 
Printer-Friendly VersionPrinter-Friendly Version
 


Part of:



Latest News
spacer View All spacer
 
February 10, 2012
 
Road to the IGF: Lucky Frame's Pugs Luv Beats
 
Analyst questions validity of unusual January NPD results [4]
 
DICE 2012: Blizzard's Pearce on World Of Warcraft's launch hangover
spacer
Latest Jobs
spacer View All     Post a Job     RSS spacer
 
February 10, 2012
 
Beachhead / Activision
Senior Operations Engineer
 
Sony Computer Entertainment America LLC
Manager Quality Assurance
 
Beachhead / Activision
Senior Front End Web Engineer
 
Beachhead / Activision
Senior Back End Web Engineer
 
Beachhead / Activision
User Experience Lead
 
Sony Computer Entertainment America LLC
Senior Software Engineer
spacer
Latest Features
spacer View All spacer
 
February 10, 2012
 
arrow Principles of an Indie Game Bottom Feeder [19]
 
arrow Postmortem: CyberConnect 2's Solatorobo: Red the Hunter [1]
 
arrow Jerked Around by the Magic Circle - Clearing the Air Ten Years Later [39]
 
arrow Building the World of Reckoning [4]
 
arrow SPONSORED FEATURE: TwitchTV - How to Build Community Around Your Game in 2012 [13]
 
arrow Happy Action, Happy Developer: Tim Schafer on Reimagining Double Fine [9]
 
arrow Building an iOS Hit: Phase 1 [11]
 
arrow Postmortem: Appy Entertainment's SpellCraft School of Magic [5]
spacer
Latest Blogs
spacer View All     Post     RSS spacer
 
February 10, 2012
 
Audio Passes: Success Through Layering
 
What the current RPG can learn from Diablo 1
 
Double Fine's Kickstarter Windfall: Will Patronage Supplant Traditional Game Publishing? [5]
 
The Principles of Game Monetization
 
Did DoubleFine Just break the publishing model for good? [14]
spacer
About
spacer Editor-In-Chief/News Director:
Kris Graft
Features Director:
Christian Nutt
Senior Contributing Editor:
Brandon Sheffield
News Editors:
Frank Cifaldi, Tom Curtis, Mike Rose, Eric Caoili, Kris Graft
Editors-At-Large:
Leigh Alexander, Chris Morris
Advertising:
Jennifer Sulik
Recruitment:
Gina Gross
 
Feature Submissions
 
Comment Guidelines
Sponsor
Features
  Sponsored Feature: Rendering Grass with Instancing in DirectX 10
by Anu Kalra [Programming, Visual Computing]
Post A Comment Share on Twitter Share on Facebook RSS
 
 
May 28, 2009 Article Start Page 1 of 3 Next
 

[In this Intel-sponsored feature, part of Gamasutra's Visual Computing section, Kalra examines ways to render realistic grass in your game, utilizing DirectX 10 and vertex shaders.] 

Because of the geometric complexity, rendering realistic grass in real-time is difficult, especially on consumer graphics hardware. This article introduces the concept of geometry instancing with Direct3D 10 APIs and shows how it can be used to implement realistic grass on consumer graphics hardware.

Instancing Grass

A typical patch of grass can easily have a few hundred thousand blades. Each blade is similar to the other, with slight variations in color, position, and orientation. Rendering a large number of small objects, each made from a few polygons, is not optimal.

Current generation graphics APIs, such as DirectX and OpenGL, are not designed to efficiently render models with a small number of polygons thousands of times per frame.

To efficiently render thousands of blades of grass, the number of draw calls needs to be drastically reduced. If the geometry of the grass blades doesn't change, the best approach is to process the grass elements in a vertex buffer and render them in one draw call.

However, if the geometry does change often-for example, if the level-of-details scheme is being used for geometry simplification-this approach won't work, because a large amount of data would need to be sent to the graphics card every time the geometry changes.

Geometry instancing allows the reuse of geometry when drawing multiple similar objects in a scene. The common data is stored in a vertex buffer, and the differentiating parameters, such as position and color, are stored in a separate vertex (instance) buffer. The hardware uses the vertex and instance buffers to render unique instances of the models. (Refer 5)

Using geometry instancing APIs helps factor common data from the unique data (flyweight design pattern) and thus reduces memory utilization and bandwidth. The vertex buffer can stay resident in graphics memory, and the instance buffer can be updated more frequently if needed, providing performance and flexibility.

Implementation Details

In the example described in this article, numerous small patches of grass are drawn across the terrain. A patch of grass consists of a vertex buffer that contains a number of randomly placed intersecting quads. Each quad is mapped with a texture containing a few blades of grass.

A natural waving motion of the grass blades is achieved by animating the vertices of each quad using a combination of sine waves of different frequencies. Color changes that occur with the waving motion and from the effects of the wind are simulated using the same sine wave that animates the grass.1

Geometry instancing places numerous small patches along a grid on the terrain. This method allows visible patches to be selectively drawn. Patches with various levels of detail (depending on the camera position) can also be introduced with relative ease.

Figure 1 highlights the dynamic culling of grass geometry. Only patches shown in blue are rendered. Refer to the code sample provided later in this article for more details.


Figure 1. Selective drawing of grass patches using geometry instancing.

---

1 Isidoro, J. and D. Card, "Animated Grass with Pixel and Vertex Shaders." http://ati.amd.com/developer/shaderx/shaderx_animatedgrass.pdf 

 
Article Start Page 1 of 3 Next
 
Comments


none
 
Comment:
 




UBM Techweb
Game Network
Game Developers Conference | GDC Europe | GDC Online | GDC China | Gamasutra | Game Developer Magazine | Game Advertising Online
Game Career Guide | Independent Games Festival | Indie Royale | IndieGames

Other UBM TechWeb Networks
Business Technology | Business Technology Events | Telecommunications & Communications Providers

Privacy Policy | Terms of Service | Contact Us | Copyright © UBM TechWeb, All Rights Reserved.