Book Image

Vulkan Cookbook

By : Pawel Lapinski
Book Image

Vulkan Cookbook

By: Pawel Lapinski

Overview of this book

Vulkan is the next generation graphics API released by the Khronos group. It is expected to be the successor to OpenGL and OpenGL ES, which it shares some similarities with such as its cross-platform capabilities, programmed pipeline stages, or nomenclature. Vulkan is a low-level API that gives developers much more control over the hardware, but also adds new responsibilities such as explicit memory and resources management. With it, though, Vulkan is expected to be much faster. This book is your guide to understanding Vulkan through a series of recipes. We start off by teaching you how to create instances in Vulkan and choose the device on which operations will be performed. You will then explore more complex topics such as command buffers, resources and memory management, pipelines, GLSL shaders, render passes, and more. Gradually, the book moves on to teach you advanced rendering techniques, how to draw 3D scenes, and how to improve the performance of your applications. By the end of the book, you will be familiar with the latest advanced techniques implemented with the Vulkan API, which can be used on a wide range of platforms.
Table of Contents (13 chapters)

Drawing billboards using geometry shaders

Simplifying geometry drawn in a distance is a common technique for lowering the processing power needed to render the whole scene. The simplest geometry that can be drawn is a flat quad (or a triangle) with an image depicting the look of an object. For the effect to be convincing, the quad must always be facing camera:

Flat objects that are always facing camera are called billboards. They are used not only for distant objects as the lowest level of detail of a geometry, but also for particle effects.

One straightforward technique for drawing billboards is to use geometry shaders.

How to do it...

  1. Create a logical device with the geometryShader feature enabled (refer to the Getting features and properties of a physical device...