How it works...

We start the process of drawing a terrain by loading a model of a flat plane. It may be a simple quad with a little bit more than four vertices. Generating too many vertices in a tessellation stage may be too expensive performance-wise, so we need to find a balance between the complexity of a base geometry and the tessellation factors. We can see a plane used as a base for the tessellated terrain in the following image:

In this example, we will load height information from a texture. We do this in the same way as we load data from files. Then we create a combined image sampler and upload loaded data to its memory:

 int width ...

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