The ocean modifier is, in my understanding, nothing more but a displacement modifier combined with a type of normal texture generated in the modifier. The parameters in the ocean modifier generates the texture, and then the object on which it is applied is displaced.
To generate an infinite ocean that doesn’t repeat itself, you’d now have to 1)Bake two or three oceans with different sizes; 2) Bake it for every frame; 3) Bake the foam as well; 4) Generate a shader that all loads this data and combines it to one nice smooth ocean; 5) apply a subdivision modifier to the ocean object and set it to adaptive subsampling
Steps 1-3 take an insane amount of data for a somewhat nice looking ocean and has to be redone for every project…
Since the ocean modifier generates the textures itself, would it not be possible to directly load the texture in the shader? This would safe an insane amount of data as know the displacement texture is only generated when the frame is rendered. Also, this would have the added benefit of getting a higher resolution foam on a lower resolution displacement texture (it’s okay if the displacement isn’t insanely detailed, if the foam isn’t though you can easily tell).
But that would require using open shading language and programming this (quite elaborative)
Will look a bit further too.
But no way to program it directly? The ocean modifier looks so realistic, because the it uses actual wave spectra as we measure them in real-life. It also generates a texture, so it must be possible to use as direct input…?
The modifier is generating textures but as an addition to geometry displacement in viewport.
The interest of a displacement in viewport is to set an interaction with other objects.
Generally, an ocean is not rendered alone. It is rendered with characters : boats, submarines and swimmers, one giant wave (higher than the others).
And those objects are deforming the displacement.
So, the idea of using a modifier is that other modifiers will be added after it, in modifier stack.
Ocean modifier is an old modifier made for 2.4x series, more than a decade ago.
Nowadays, that would make sense to create a texture node usable by geometry nodes and shaders.
Just an empiric method. i’ m not a scientist at all. but here is my vision as a guy coming from a fisherman family in the western part of france:
Lets build a wave displacement shader.
assuming we have got a 15 meter boat on a 400*400 meter ocean.
due to the huge scale… we gonna scale the plane to avoid impossible values in shader editor.
we gonna use object coordinate system for mapping then the procedural shader “wave” will have a scale inheritance from it.
Ocean is maid of crossing waves of different “size” moving at different speed regarding the flux force.
Let’s call that under waves and over it there is some wind effect.
we gonna focus first on “houle” (under waves)
To avoid resource consuming displacement with cycle for nothing, let’s reproduce the big wave’s shader in geometry node. By this, we’ ll be also able to stick the boat over the ocean surface.
you can notice that the wave’s scale is very strong. the boat cannot fish, it’s too dangerous. the captain decide to navigate “à la cape”.
so we must play with the noise scale to avoid everybody’s death onboard.
I’d rather thought of a challenge of Geometry Nodes lovers.
As you can see, @skuax started.
But there are a lot of settings in Ocean modifier.
Depth of ocean and smallest wave setting are there, because generated waves don’t have same size.
Choppiness of wave, speed of wind and spectrum can make them more or less frightening.
And Foam is generated only on a part of waves.
That are a lot of variations that is making it more realistic.
So, if several Geometry Nodes experts give it a try, they could determine what is currently missing in Geometry Nodes to reproduce modifier.
That way, developers would have to spend time and to figure it out.
They would have minimal work to port it to Geometry Nodes.
If pattern generated by Ocean modifier was available as a 4D procedural texture in Geometry Nodes, and if another node was created for such specific displacement, user would not have to set-up several dozen of nodes.
I am wondering if a kind special displacement node could be created to generate landscapes and oceans, too.
Amazing work!! Very cool to be able to get this far with geometry nodes / shader nodes.
Some addition of wave theory to make it more realistic. These are all so-called “first-order” Navier-Stokes waves: basically a normal sine function. When water gets more shallow (the depth parameter) or when the waves get longer (swell, less steep → steepness parameter), some harmonics will come into play, creating second-order and sometimes even third and fourth order waves. This will make them steeper as well.
You can see that effect in this picture of very nice swell waves:
I’m on my journey on the ocean.
I’ll try to incorporate the maximum stuff i can inside.
i don’t really know where i’ m going. But i 'll try to do my best to incorporate as much thing as possible without making it to heavy…
I use Eevee to tweak the animation and roughly put shading etc…
then after… i ll switch to cycle…
there is a lot to do, and any advises like yours and from the others ll be welcome.
Group input has wave length in terms of blender units (1m, so 100 as input is 100m wavelenght). Wave height is wave height, etc. You can include a factor for second order and third order harmonics (0.5 and 0.25 by default)
Thing though is, to make a proper realistic sea, you’d have to multiply waves on top of eachother in a bunch of different directions, probably like 10-20 times, the more the better.
Actual oceans make use of a so-called “wave spectrum”: a summation of many smaller sinuses. That’s what gets the nice random look.
Then for animation, the waves also have different speeds, depending on there wavelength. This is what you also see in real life: wave catching up on eachother, suddenly splitting up, etc.
All of this can be programmed in geometry nodes / shader nodes of course, but it will take a lot of nodes. This all is implemented in the ocean modifier by default.