Contents
Sponsored Feature: Rendering Grass with Instancing in DirectX 10
 
 
Printer-Friendly VersionPrinter-Friendly Version
 


Part of:



[More information...]
 

Latest News
spacer View All spacer
 
February 9, 2010
 
Dragon Age: Origins Sells In 3.2 Million Units [1]
 
Interview: Composer Garry Schyman Talks BioShock Soundtracks
 
Adult Swim: Don't 'Hamstring' Developers With Existing IP
spacer
Latest Jobs
spacer View All     Post a Job     RSS spacer
 
February 9, 2010
 
Tarsier Studios
Senior Game Engine Programmer
 
Konami Digital Entertainment Co., Ltd.
Sound designer
 
Vicarious Visions / Activision
Tools Programmer
 
Trion Redwood City
Sr. Environment Modeler
 
Trion Redwood City
Sr. Graphics Programmer
 
Sparkplay Media
Senior Game Designer
 
Blue Fang Games
Producer: Online/Mobile
 
Blue Fang Games
Senior Server Engineer: Online/Mobile
spacer
Latest Features
spacer View All spacer
 
February 9, 2010
 
arrow Television, Meet Games
 
arrow Two Halves, Together: Patrick Gilmore On Double Helix [1]
 
arrow The Road To Hell: The Creative Direction of Dante's Inferno [18]
 
arrow The Sensible Side of Immersion [10]
 
arrow Jumpstarting Your Creativity [5]
 
arrow Truth in Game Design [49]
 
arrow Postmortem: Vicious Cycle's Matt Hazard: Blood Bath and Beyond [4]
 
arrow Developers React: The iPad's Future [16]
spacer
Latest Blogs
spacer View All     Post     RSS spacer
 
February 9, 2010
 
[Lineage 2] Freya Update Is Just a Beginning ②
 
Swashbuckling for Landlubbers: Why you may already be encouraging piracy! [9]
 
[Lineage 2] Freya Update Is Just a Beginning ①
spacer
About
spacer News Director:
Leigh Alexander
Features Director:
Christian Nutt
Editor At Large:
Chris Remo
Advertising:
John 'Malik' Watson
Recruitment/Education:
Gina Gross
 
Feature Submissions
Features
  Sponsored Feature: Rendering Grass with Instancing in DirectX 10
by Anu Kalra
0 comments
Share 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:
 


Submit Comment