My Message close
GAME JOBS
Contents
Sponsored Feature: Rendering Grass with Instancing in DirectX 10
 
 
Printer-Friendly VersionPrinter-Friendly Version
 


Part of:



Latest Jobs
spacer View All     Post a Job     RSS spacer
 
May 19, 2013
 
Sony Computer Entertainment America LLC
Sr. Network Systems Engineer
 
Treyarch / Activision
Technical Animator
 
Amazon Game Studios
Sr. Game Designer
 
Amazon Game Studios
Quality Assurance Manager
 
Amazon Game Studios
Lead 3D Environment Artist
 
Amazon Game Studios
Game Graphics Engineer
spacer
Latest Blogs
spacer View All     Post     RSS spacer
 
May 19, 2013
 
Making 2D Games With Unity [1]
 
All You Need is Love [3]
 
Students: Tips for Learning Game Development Over the Summer [2]
 
All Your Nintendo Let's Plays Are Belong To Nintendo? [86]
 
Even Further Down the Curation Rabbithole [12]
spacer
About
spacer Editor-In-Chief:
Kris Graft
Blog Director:
Christian Nutt
Senior Contributing Editor:
Brandon Sheffield
News Editors:
Mike Rose, Kris Ligman
Editors-At-Large:
Leigh Alexander, Chris Morris
Advertising:
Jennifer Sulik
Recruitment:
Gina Gross
Education:
Gillian Crowley
 
Contact Gamasutra
 
Report a Problem
 
Submit News
 
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
 
Top Stories

image
The laws behind Nintendo's Let's Play crackdown
image
New layoffs reach Trion
image
How developers mess up immersion (you might be doing it wrong)
image
Steam Trading Cards: The next-gen of achievements?
Comments


none
 
Comment:
 




UBM Tech