Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Direct3D Rendering Cookbook
  • Table Of Contents Toc
Direct3D Rendering Cookbook

Direct3D Rendering Cookbook

4.1 (10)
close
close
Direct3D Rendering Cookbook

Direct3D Rendering Cookbook

4.1 (10)

Overview of this book

Table of Contents (19 chapters)
close
close
Direct3D Rendering Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1
Further Reading
2
Index

Simulating ocean waves


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

Getting ready

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.

How to do it…

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

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Direct3D Rendering Cookbook
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon