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 ...

Get Direct3D Rendering Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.