Here some updates!
I use Gerstner waves for the main shape of the sea: a variation texture is added to the displacement to break the global smoothness.
Instead of compute many other small waves for the surface, I’ve made a specific normal map with both small and capillar waves. This normal is panned at different sizes, speed and directions 4 times, to have a noisi surface.
The foam (and its normal) is blended based on wave height.
All other effects are missing, for now
P.S. I apologize for the bad video quality and cut… I had a lot of problems with screen capture today
Hi again… just some updates!
The material is growing fast while adding visual details.
I painted a new set of foam textures: I use 3 variations of the same pattern for the overall diffuse foam, the one around object in scene and for the crest of the waves.
I made some changes to the waves generation formula too, tweaking some functions and values.
There is also a new feature, but I’m not sure of the result, so I could decide to remove it: instead of flow textures like in previous versions, now a grayscale texture drives a “phase shifting”: this should slow a wave when near an obstacle… doing this per-vertex ends in bending the wave. You can see a little of this effect in the video.
The foam around rocks is controlled by a texture (the same used for phase shifting…one channel for each thing).
I tried to make foam around things using a DepthFade, but with translucent material, as you know, a lot of thing goes mad!
Still working on it!
Today I figured how to obtain a long desired effect: to have the foam of the crests only behind the wave. To paint the foam basing only on height seems unrealistic… A wave breaks on top and leaves white foam behind it…
So after some tries I ended with a dot product between the vertex normal and the wave movement direction: the result tells me if I’m in the front or back side of the wave.
The problem is that I’m using DDX and DDY for the normal… and this approach gives me nard normals, that show some mess with tessellation.
If I only find a way to smooth the result or compute the normal in a fast and different way!
Do you guys have any ideas?
Again, I apologize for the bad video compression that sometimes destroy the video…
Looks awesome berna! Each video is looking better and better!
I didn’t realize you switched to Gerstner waves, did you switch formula’s or are you still using the Beaufort formula as well? I must have missed reading that part… If you did switch, was it because you could’t get the look you wanted from the Beaufort formula?
Anyways, great to see your progress on this, it looks fantastic! Keep it up!
Yes, I switched.
At the beginning I used a texture with different greyscale “cloud filter” stored in RGB channels: they were simple photoshop filters panned at different speeds and directions. The look was nice but the waves had a strange shape… too rounded.
Gerstner waves instead gives me a better shape and after some tries I’ve found a formula that seems ok to me.
So yes… the reason is that the look given by textures wasn’t what I wanted, in particular because I want to control the “weather”, and the shapes have to change a lot.
Ahh, ok, I read through the thread again, and I can really see the difference between the two methods, the Gerstner waves do look a lot more like real waves, so that makes sense. And I’m sure the weather is a big issue, especially if you are planning to drive the waves (partially) by the wind speed. Are you planning to go that route? or is it too big of a performance hit to calculate all that as well? It would be a nice feature, but I think for mine I will stick to waves that “appear” to be driven by the wind and fake it a bit, I don’t need quite that level of realism for my project. How you have yours set up currently looks really good, are you just driving it from a blueprint?
I just started working on Gerstner waves myself (got the actual function working, now implementing it in a material), I decided to give it a try after reading through the GPU Gems article. I was considering using the Beaufort method at first, but after reading up some more on the forums (like Handkor’s tutorial for example) I decided to go with Gerstner. No real reason why, but I’m glad I did! I just noticed you mentioned using the Tessendorf paper, and it sounds like it was a simpler way of going about this issue, so I think I have some more reading to do this weekend!
Implementing this has been pretty complex, I started out the same way with basically a more advanced version of standard ocean material (with panning height & normals). That obviously didn’t work for realistic water, so I decided to try the hard way. So far I’m glad I decided to go for it, I have learned a lot about materials (and rendering in general) in the process. I really appreciate all of the info you have in this thread, so thank you!
At the moment I drive by the Beaufort parameter… Its value tells a function what set of other parameters has to pass to the main function that generate the waves. I use a direction, a max wave height, the steepness and an alpha value for the diffuse foam. All others variable for the gerstner formula are calculeted by these (for example the frequency of the wave and the magnitude k of the wind). I could choose to input the wind speed (in km/h) instead of the max wave height and do the same: the calculation is done already, but not used.
I choose the Gerstner formula from the Tessendorf paper also because it’s the most used formula in other papers, articles… So I could read more about it around the internet.
About blueprint… no blueprint for now I’ts all material
Regarding James’question… as I said I don’t know at the moment if the shader will be available for all of you, mostly because it will be used in a commercial game we are developing, so we have a lot of things to consider.
But I also said that I’ll do some sort of guide or tutorials, sharing what I’ve learned doing this material.
At the moment I’m still making changes… I completely redone (for the 3rd time!) the wave generation node… I’ve read a lot of papers and book pages about oceanography… the hardest part was try to choos all the values in order to have something that looks real in its behaviour. There are precise reletionship between all the parameters in a sea, and I deeply wanted to find all these relationship and put them in the shader.
Now the waves are better in my opinion, and also the surface look: I’m still struggleing with the “stormy” sea, that seems to need a lot of fine tuning to have a good look… Calm sea is quite easy to achieve, but big waves and storm easily breaks the magic!
I’ll keep you updated in the next days with some images/videos of this new (and I hope last!) version
cool are you doing all of this the material editor or are you doing C++ coding as well. Also does this run on the OSX version of unreal? I’m a Mac guy and developing on the mac so if you need a tester for this I would love to give it a shot.
Great work. If I could offer some advice on how to make the gales (force 8+) look better, water becomes a lot darker when the wind starts to pick up and from watching the videos I feel that the water does not go dark enough. The foam and the white horses make the sea look to light as there is a sudden increase in the amount of white on the water. Also the sky will help a lot in making the sea seem stormy I can say the sea looks at its most stormy on a darker overcast day. Last thing would be the foam or crests of waves at the moment it looks like they will always appear on the peak of the wave but really if your going for a realistic look you should look into trying to make the waves brake at the top as that’s how the foam forms this will mean you won’t have this massive line of foam which looks unrealistic unless your on a beach.
Anyway I’m enjoying seeing how this project has progressed and I am looking forward to future updates.
Thanks for all your advice Matt… I’ll take all in account on Monday, when I’ll work on it again
For now, this is just a “sneak peak” of the new shader: there is a huge amount of changes from the last version… and I hope to have increased the look of my sea.
I have to tune the colors and solve some other problems.
If I only had translucency and specular working fine!!
I am looking forward to modify my Gerstner wave equation to include depth at point (x,y), in order to change the displacement in the shallow areas , based on the below document -
But I am unable to find a function which can calculate the height of the ocean floor(the z distance between the translucent material at a point(x,y) and the opaque landscape at the same point below it , when the water is at rest). Can you give me a brief regarding how to calculate depth , is there any other approach to make the water look more realistic in the shallow areas ?
Thanks in advance!!! the result seen in your video and pictures are amazing and just what I want.
Hi sameek…sorry for the delay but I was quite busy… my 1st son was born two weeks ago so my work was left a little behind… and so the forum!
I don’t calculate the real ocean deep… I planar project a greyscale texture where white is max depth and black is 0. Then I have a “Max depth” parameter that I use as value for white.
I know is not a great idea, but it seems to work quite ok. You could have some problems with texture compression (well…I had) but you could try this way.
I tried my shader in a more complex scene and I have to say…it seems quite heavy. This discouraged me a little… In the future I’ll have to perform heavy optimization…
Hi Berna! I’ve been reading your works on this and I could tell you that it is really beautiful! I’ve been playing things myself with ocean waves using gerstner wave from tessendorf and I’ve got some questions for the ocean detail.
How do you handle the foam details to occurs only on the crest section of the waves? Do you use opaque or translucency material? How do you handle the specular for the micro ripples?
The last screen shot was not using beafort scale anymore right? How do you transition between calm sea and stormy sea then?
Hi guys… and sorry for my long silence!
Answering the last question by ajbombadill… I had to stop working on my ocean
It turns out to be too heavy in terms of performance to run smoothly in VR (especially on PS4, where there is no hardware tessellation).
So it was dropped from our project Loading Human wich is taking all my time (but it’s going fast and well
I really hope to return on this material and try to improve it… I’ve learned a lot of interesting stuff working on our game.
Probably the community ocean is way better than mine now
I again apologize for my silence on this topic and, to all of you, keep up your good works!