-
Book Overview & Buying
-
Table Of Contents
Direct3D Rendering Cookbook
In this recipe, we will look at a tried and tested technique for simulating ocean waves using a series of Gerstner waves at varying amplitudes, wave lengths, frequencies, and directions within a vertex shader (or domain shader).
For this recipe, we need to render a plane along the x and z axis. The completed solution uses an FBX scene with a simple subdivided mesh and UV coordinates for a normal map, however, a quad passed to the tessellation pipeline will also work; or better yet, a mesh generated in the vertex shader based on the SV_VertexID and SV_InstanceID input semantics.
A prerequisite is the mesh renderer and shaders that implement normal mapping as shown in the Adding surface detail with normal mapping recipe of Chapter 6, Adding Surface Detail with Normal and Displacement Mapping.
As we will be generating sine waves over a period of time, we need to add a Time property to our PerFrame constant buffer. Then we will implement the vertex...
Change the font size
Change margin width
Change background colour