How to do it...

  1. Load or generate a model of a flat, horizontally-aligned plane. Two attributes--position and texture coordinate--will be needed. Upload the vertex data to a vertex buffer (refer to the Loading a 3D model from an OBJ file recipe from Chapter 10, Helper Recipes and to the Creating a buffer and Using staging buffer to update buffer with a device-local memory bound recipes from Chapter 4, Resources and Memory).
  2. Create a uniform buffer for two transformation matrices (refer to the Creating a uniform buffer recipe from Chapter 5, Descriptor Sets).
  3. Load height information from an image file (refer to the Loading texture data from a file recipe from Chapter 10, Helper Recipes). Create a combined image sampler and copy the loaded ...

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.