Terrain height map influences ocean wave heights?

I’m not looking for code, just ideas on how to go about this. My idea is to use the terrain’s height map as a means of determining a procedurally generated plane’s wave height as it nears the shore. I would like the large rolling waves to turn into a simple ‘breaking’ or foamy wave that’s has a much sharper peak, and as the waves and terrain near each other the wave height diminishes into a nice flat wave that acts realistically on the shore. I’m not entirely sure how to generate the mesh, but I have a fairly attractive community procedural ocean project as reference. Problem is, I dislike using what I didn’t make. Thanks for your time.

i suggest you learn CG/HLSL that would cover some parameters and learning about 3d space on how to create your own mesh’s you can use catlikecoding.com will cover how to generate mesh but not animate how ever you can use the in built Physx in Unity that was built by nvidia and also check out there GEM documentation. hope that kind of helped

Here’s my idea:

Create a script that places a game prefab at the outer regions of your water quad. Rotate each object (wave, separate from the ocean) towards the center of your map (in my case, it faces towards the center of an island). I recommend having a set number of instances and recycle them once they’re unneeded. Create an overall max number of waves, and then modify the current number of instances and their speed based on weather.

Create a second script that raycasts from the bottom the the prefab to detect the the object’s height above the ocean. Use the height to change the place within the object’s animation. I would coroutine this and create a function to approximate the animation state based on speed, an average terrain change from the last raycast or two, and so on. It’s a similar concept that’s used to smooth networked movement. An wave manager script (basically a particle system) could do this for each wave. You’ll need to move the wave forward (since it’s oriented towards the center. For more complexed wave direction, perhaps make a map that dictates the wave object’s rotation.

the wave object would have an animation the morphs the mesh from a rolling wave, to a breaking wave, to a diminished wave (like what you see on the shore). If you want to get fancy, create a second animation for when the mesh hits a cliff or something similar. You can have a modifier that influences the wave animation position to fake calm or nasty weather.

— / \ — /\ — ^ — “ — + — # LAND ABOVE WATER # — + — “ — ^ — /\ — / \ — {quad} —

My idea is to use a quad to represent the average water height. This quad will be moved up and down based on a sign wave. Each wave will have a wedged shaped collider. The combination of the quad height and wave colliders should provide a rather simple means of buoyancy. Things that are buoyant are forced upward (against gravity) based on the distance below the water quad’s height. The wave colliders would offset the water height temporarily to mimic that the buoyant object is floating on the surface of the wave.

To keep the ends of the wave mesh from showing below the ocean quad, I’m guessing you could tinker with a shader to hide parts of each wave that’s below the ocean quad.

I haven’t tested this concept, but if you do please let me know how it goes.