You can use the Ocean module (described below) to add ocean waves to a standard three.js Plane mesh. Modules are available for use with WebGPU and WebGL2 programs. Here are instructions for using the modules in your program. You can also reference the sample programs below [revised 9/22/2025]
Ocean waves from the movie “Dunkirk” compared to waves created by this module.
GRDMAP and GRDWTR MODULES
I have now added a new page from which you can download the version of the GrdMap module (GrdWtr) that works with the Ocean module to provide you with a moving map of animated waves that extends to the horizon.. [EDIT 9/15/25: The linked page is being revised.]
UPDATE 5/31/2023
The “GrdMap and GrdWtr” page listed above has been updated. The GrdWtr module is now a simplified version of the GrdMap module designed to work with the Oceans module. The GrdMap module allows you to add and modify textures and materials.
WEBGL2 VERSION3 [NodeTextures] (4/6/2024) [Outdated - Links removed]
I have now created a Nodes version, which I will add to the webpages.. [EDIT 9/15/25: This link is removed because this version is a historical anomaly that was only valid for a couple of revisions]
WEBGL2 VERSION3 [Final] (9/15/25)
Here is a static demo of the latest version of the WebGL2 Ocean module. As noted above, this version cannot use NodeTextures, which are now only available with WebGPU. The Ocean module can be used with the GrdWtr module to create a moving map as shown in this demo These modules (Ocean3 and GrdWtr3) are available in the xtra_perm/jsm directory of my GitHub Repository (see link below). The GrdWtr3 module has been updated to work like GrdWtr4 (below). The only difference between the two modules is that GrdWtr3 uses standard textures and GrdWtr4 uses node textures.
WEBGPU VERSION4 (Summer 2024) [Outdated - Links removed]
Since, after r165, NodeMaterials no longer work with WebGL2, I was finally “forced” to create a WebGPU version of the Wave Generator. This is essentially a scaled-down version of a WebGPU Wave Generator created by Attila Schroeder (which uses a butterfly texture). Since this is for a flight simulation, I have focused on trying to make the water look better from both high and low altitudes. I have moved my files to my GitHub Repository. [EDIT 9/15/25: This version is outdated and the links have been removed]
WEBGPU VERSION4 r167 (8/15/2024) [Outdated - Links removed]
And, almost as soon as I got the WebGPU version working, r167 changed how WebGPU is implemented in three.js. [EDIT 9/15/25: This version is now outdated and the links have been removed ]
WEBGPU VERSION4 [Final] r180 (9/15/2025)
For archives purposes, here is a static demo of the latest version of the old Ocean module which uses texture buffers shaders. The Ocean module can be used with the GrdWtr module to create a moving map as shown in this demo. These modules (Ocean4 and GrdWtr4) are available in the xtra_perm/jsm directory of my GitHub Repository (see link below). For fun, here is a display that shows the buffers in action. These are the same in the WebGL2 version.
NEW WEBGPU VERSION [Compute Buffers and Shaders] r180 (9/15/25)
Here is a static demo of the latest version of the Ocean module. This module is a stripped-down version of the Ocean program created by Attila Schroeder. That program is complete revision of prior programs and mostly uses compute shaders in place of texture shaders. This module was created with his assistance (and in this case, the word “assistance” is an understatement since I am a complete novice with regard to compute shaders). This version has many more variables and the compute shaders allow for a significant increase in resolution.
Here is a display that shows the various buffers in action. The top row of buffers are statics. The middle row shows the final resuls for intermediate buffers. The bottom row shows the displacement and normal maps.
As before, the Ocean module can be used with the GrdWtr module to create a moving map as shown in this demo. The latest version of both modules are available in the jsm directory of my GitHub Repository. Over time, all of the GrdWtr modules have been modified to spread a multi-colored diffuse texture and a corresponding roughness map over several grids. Not only does this make the appearance more realistic, but this makes the ocean look more interesting and the colors help hide tiling.
A FINAL NOTE (9/15/2025)
Since this is probably the last major version of the Ocean module, I am revising this original post to eliminate excess discussion and the (now broken) links to outdated versions of the Ocean and GrdWtr modules. Instead, I have created links to an archive of the latest versions of the old WebGPU Ocean module (version 4) and the WebGL Ocean module (version 3) for those who are using WebGL. All are updated to r180. Those versions are available in the xtra/jsm directory of my GitHub Repository (link above). I am retaining the chronology of my posts so that all the helpful comments below can be viewed in context.