Creating crashing waves

Not sure if this is the correct place to ask but I am attempting to create crashing waves that can form a barrel like real waves at a good surf spot. I made a water material that looks pretty good and flows well and I used the Gerstner waves to create some waves but to my knowledge, they are just based off of sine and cosine so I can get waves but not waves that will crash and create a barrel. I was thinking of creating an elongated cube in blender or something and either rigging it in areas that I would want the wave to crash and put my material onto that and just work with the animations but I am not sure if this is the best way or if there was a better simulator or something out there. I am pretty new and I have done a lot of research but have not been able to figure it out yet.

If you are going to sculpt it, an alembic geometry cache is best.
This ofcourse will not provide any sort of physics feedback / your waves will be purely visual.

How about this:

I don’t know if he goes into detail anywhere…

That is a good idea but unfortunately i will need physics feedback so I think I am going to have to create a mesh and just calculate buoyancy for different actors. I got a mesh rigged and animated in blender so I think I will work with that for now until it seems to not work. I would not have more than 2 waves at most being spawned at a time so I am hoping that it should not cause too much weight since it will only be my water material on a plane, the two waves and two other actors in the scene, along with a small landscape that will be purely visual as the whole game takes place in the water. If I do decide to have more waves off in the distance for visuals than I will definitely use the alembic geometry cache so thank you very much for bringing this to my attention!!

I seen that! He did a wonderful job with it but does not give much info and I seen some comments requesting tutorials and also comments suggesting that he does not do tutorials or release his stuff publicly but man does it look good.

There isn’t much to the physics. You need to entierly take over for the engine and create a function that returns the wave height in world space based on Location X,Y, and Game Time.
whatever that formula is, you just use the exact same in the material.
You won’t be able to get waves to crash. generally anything Over a perpendicular is near impossible to get accurate. So wave barres done with a single mesh are not really possible.
However, who cares? Physics only matter at the wave’s edge. you can fake the curl without much of an issue.

Actually you can have physics feedback if you drag invisible meshes along the crashing waves, meaning also you can drag particles to increase realism. Since it is hard to mimic nature, you have to fake close enough for the audience to believe it is the real deal.

that is very true, I did not even think about the fact that the curl is really just an aesthetic and nothing that needs physics added to it.

The invisible meshes is a good idea and yeah I was thinking of using a socket to add particles at certain areas but I am sure there is a better way, that I am still learning about but that is down the line and I am not trying to make the game super realistic but it would be nice to have that realism but it is somewhat lower on my priority list. By about game 3-4 I am hoping to be able to make things a lot more realistic!

Dragging invisible meshes is a nice idea, however note that even a cpp implementation of a standard gestner cluster (probably exactly as used within the community ocean project) can be laggy.
its probably Less Laggy than adding extra math to try and move multiple objects since you can do the math for one object and be done with it.

You could also fake it. You have the (amplitude?) Of the wave, so you could spawn and move an invisible mesh at the same interval that’s called for.
maybe spawn and move a physics area that adds resistance to the character by altering the appropriate physics values.

Assuming you have swimming states this could produce a much nicer feeling than anything else, since you go through waves and slow down due to the volume.

Kind of an interesting concept I have yet to play with.

I would suggest making a system that generates shore waves at this point.

The hard part is to tie it all into a single material. Mostly because by default you have no way to create custom loops based on objects within the scene. You could make something with a custom HLSL and/or try to populate a material parameter collection at runtime.
however there are basically no guides on doing anything of the sort (at least specifically for oceans and as of 8 months ago last I checked) so you are mostly on your own.

In terms of rendering costs, its really not much different. Oceans are expensive. You just have to deal with it.

you can find the cheapest possible examples of waves in the content examples btw. Sine based easy stuff that would almost be perfect for a shore wave with a variable cadence.

Last thing I have to add…
I think you can get Niagara to spawn particles based on the normal of the mesh at runtime.
think, because niagara is very pliable but also very new (few tutorials, basic content examples etc).

Then again, if you are spawning and moving physic volumes you can use the same logic to spawn the particles that give the foam effect… it becomes more trivial since it generates the effect rather then needing the effect to be generated by the material.

Lagginess is one thing I was definitely worried about but yeah it is something that just has to be dealt with unfortunately. The physics volume is a good idea actually because like you mentioned it would slow the character down when going through the waves but I think that I would have to increase the buoyancy if that is the case so that the character could move with the wave rather than just going through it. I am attempting to make a surfing game so the character would need to be able to move with the wave, on the surfboard of course. I did take a look at Niagara to see about using the particle system to create a sea foam at a point but I do not know necessarily how it works yet. I’m thinking I may have bit off a little more than I can chew for a first game.

True, but if you prototype it without worrying too much about the material you may be able to still get something going.

forget “bouyancy” for now and fake it.
say that Z is derived straight from sine. Make uour pawn/Actor oscillate up/down with that.

then implement a way to solve for z at X and Y. This makes it so you can try to move with the wave. Move on from there…