Book Image

Direct3D Rendering Cookbook

Book Image

Direct3D Rendering Cookbook

Overview of this book

Table of Contents (19 chapters)
Direct3D Rendering Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Further Reading
Index

Filling the G-Buffer


A geometry buffer or G-Buffer is a collection of one or more textures that contain attributes of the current frame necessary to render the final scene at a later stage, usually within screen space. The attributes stored in the G-Buffer might consist of data, such as position, normal vectors, diffuse, and other material properties.

This recipe prepares a G-Buffer that collects the information needed for a classic deferred rendering technique (or deferred shading); however, the approach can be easily extended to cache information for any deferred technique.

Getting ready

We will need a scene with a number of objects and varying materials. We will use the MeshRenderer class and vertex structure from the Adding surface detail with normal mapping recipe in Chapter 6, Adding Surface Detail with Normal and Displacement Mapping. We will assume that the second and third texture slots in both the loaded meshes and the pixel shaders are used for normal maps and specular intensity...