User Tag List

Page 1 of 2 12 LastLast
Results 1 to 40 of 44

Thread: Parametric "Beaufort scale" ocean

  1. #1
    0

    Parametric "Beaufort scale" ocean

    Hi guys!
    I'm working on Loading Human VR game and preparing some useful materials for our project.
    After some days mixing different ideas here is the result for our sea shader: I tried to mimic (as read on a paper about Assassin's Creed Black Flag) the Beaufort scale.
    I have some parameters such as basic colors and textures, but the overall look is driven by the beafort parameter (from value 1 to 12).
    I wanted to generate waves displacement using FFT, but after some tests I decided to use a texture with different cloud patterns stored in its channels.
    There is also a "foam" texture with some variations.
    What do you think about it?
    Name:  oceano2web.jpg
Views: 9440
Size:  332.5 KB

    It will be amazing to have a sort of "collision detection" with the landscape in order to block waves from passing through rocks and stuff...
    I'm also thinking about opacity: it could be great to have my sea transparent depending on its depth, but I'm having some problems with it.

  2. #2

  3. #3
    0
    UE Community Manager
    Join Date
    Jul 2014
    Posts
    1,321
    This is looking really, really awesome. Do you by chance have video of it in motion? Some time spent in adding said collision and some mist/ spray particles and you're looking just stellar.

  4. #4
    0
    Hi!
    I'm still working on it and the development of our game will take quite time... so I'm sure I'll tweak and change this shader a lot of times.
    Here is a short video, showing the runtime changing of the parameter: I have to tune the reflections (open sea is not so reflective) and adjust the speed calculation, because when calm the waves seem to move too slow.


    At the moment I think I can't completely share it with the community, but if ok for you guys I could share with you tips and tricks... until the company decide to release more
    I have a "cloud" texture for normal and displacement both... just the scale is different (for normal I used the texture at a smaller scale).
    I used the 3 channels of the image to have some movements and variations.
    There are 3 foam variations that are blended on the highest part of the waves and near the rocks: for the coastal foam at the moment I use vertex color, but I'd like to automate this process detecting the geometry of the scene in some way.
    All the textures are in world scale, so I can change the size of my plane (or terrain) without worrying of the tiling. This gave me a little problem because panning a texture in world scale doesn't allow me to rotate the sea... so I made a custom "WorldAlignedPanner" that takes in input a direction vector (the same I use to change the tiling of the textures and drive the waves in a specific direction). To keep the math simple I can choose only between the four main direction at the moment (N, S, E , W)

  5. #5
    0
    Champion
    Join Date
    Mar 2014
    Posts
    630
    Quote Originally Posted by berna View Post
    Hi!
    I'm still working on it and the development of our game will take quite time... so I'm sure I'll tweak and change this shader a lot of times.
    Here is a short video, showing the runtime changing of the parameter: I have to tune the reflections (open sea is not so reflective) and adjust the speed calculation, because when calm the waves seem to move too slow.


    At the moment I think I can't completely share it with the community, but if ok for you guys I could share with you tips and tricks... until the company decide to release more
    I have a "cloud" texture for normal and displacement both... just the scale is different (for normal I used the texture at a smaller scale).
    I used the 3 channels of the image to have some movements and variations.
    There are 3 foam variations that are blended on the highest part of the waves and near the rocks: for the coastal foam at the moment I use vertex color, but I'd like to automate this process detecting the geometry of the scene in some way.
    All the textures are in world scale, so I can change the size of my plane (or terrain) without worrying of the tiling. This gave me a little problem because panning a texture in world scale doesn't allow me to rotate the sea... so I made a custom "WorldAlignedPanner" that takes in input a direction vector (the same I use to change the tiling of the textures and drive the waves in a specific direction). To keep the math simple I can choose only between the four main direction at the moment (N, S, E , W)
    Wow i understand that you cant share, but can you find it in your heart to make a tutorial on this?

  6. #6
    0
    UE Community Manager
    Join Date
    Jul 2014
    Posts
    1,321
    love it

  7. #7
    0
    Unreal Engine Support
    Join Date
    Apr 2014
    Posts
    635
    Fantastic work berna! The foam created from the waves looks awesome. I hope that you will be able to release asset, or perhaps make a tutorial, in the near future. Keep up the great work!

  8. #8
    0
    Quote Originally Posted by berna View Post

    It will be amazing to have a sort of "collision detection" with the landscape in order to block waves from passing through rocks and stuff...
    You can try using the depth buffer along with the clip() function in the shader to accomplish this. Though beyond that I'm not entirely sure how to set it up off hand.

    BTW - Loading Human is one of my most anticipated games!

  9. #9
    0
    Hi guys!
    Still working on it... I have to finish another task in these days, so I'll go on a little slower on this.
    Yesterday I made a simple panner driven by a flow texture, to flow the generated displacement map around static objects.
    It was quite difficult (to me) to get rid of artifacts keepeing a few nodes but now I have something similar to what I wanted.
    It works on big displaced waves now (it doesn't affect the normal map) but I've soon discovered a problem: flow is good for slow fluids (in my case, beaufort parameter from 1 to 4...or maybe 5).
    When the sea is stormy, water obviously doesn't flow around things... but smashes against.
    I'm thinking to keep the flow texture but lowering it while increasing beaufort...
    Or probably get rid of it and replace with something else!!
    Here is a short video of this flowing...
    Bye all!

  10. #10
    0
    Hello!
    I've read a lot in the past days about waves generation... unfortunately math keeps me away from FFT (despite the fact before my degree I passed an exam involving it! ).
    Another important point is that in Loading Human we don't need an hyper-realistic sea: I want to be able to change the weather conditions for narrative reasons during the game, but I could bet that we won't have sailing sequences
    So I decided to call one of the coders and do everithing by myself using the material editor.
    I've read on Epic Forum this thread by user Kyle_Katarn (all my thanks to you for the inspiration, bud)
    https://forums.epicgames.com/threads/970990-Gerstner-Wave-Implementation-Am-I-doing-this-right
    and tried to switch from texture-driven displacement to generated waves: gerstner waves seems to me a good choice: easier than spectrum-FFT ones and nice result.
    So I modified a little Kyle_Katarn structures and displaced a plane mixing 8 waves.
    Here is the result.

    I should mix more waves, so a way to do that quickly is needed.
    Then I also need to obtain a detail normal map... and on that base add again all the other effects you know (beaufort parameters, reflections, foam,ecc)

    I'm not sure if I'll go along this way... but it's worth a try

  11. #11
    0
    Champion
    Join Date
    Mar 2014
    Posts
    630
    Can you please make a tutorial on how you are doing this?

  12. #12
    0
    Very cool! You should check out JBaldwin's Vertex shader for a Beaufort scale water system too, in tandem you could rule the world

  13. #13
    0
    well done man, well done!
    Game Artist

  14. #14
    0
    Quote Originally Posted by WCode View Post
    Can you please make a tutorial on how you are doing this?
    Hi!
    At the moment I'm fully busy on several things regarding Loading Human (including this shader) and a mobile game, so I can't really afford making a tutorial.
    But most important, I'm doing a lot of "trial and erros" with this ocean... trying to figure how things work, understanding what I really need and how to fulfill these needs.
    So a tutorial done right now will be a confuse mess of unsure things, and I'm afraid not very useful to you guys.
    By the way, I promise that I'll give you some guide when I'll find the right way to do this headcache-giver sea

  15. #15
    0
    I've found an error in the GPUGems formula for Gerstner wave generation: it seems quite strange to me that nVidia guys made this mistake... so I'm afraid I'm missing something!
    The add the result of the waves mixing to the vertex position... but I've found it's more correct to subtract it (like in the Tessendorf paper): this allow the steepness factor (that controls the sharpness of the wave) to work correctly.
    But now I have another problem popping out if using tassellation and World Position Displacement: my shader affects the new vertex from tassellation, but moves these vertex in a strange, noisy way.
    They seem to the displaced according to some short wavelenght wave and flattening to the highest position.
    You can see here that from a long range the mesh is ok... zooming in the tassellation begins to mess the plane...
    Any ideas?
    Name:  tassellated_waves.jpg
Views: 3501
Size:  63.0 KB

  16. #16
    0
    Samaritan
    Join Date
    May 2014
    Posts
    111
    I am also using GPUGems and I just changed my material to subtractions and yes the wave steepness seems more pronounced. It does look better. My normals on the other hand no longer matched my waves though.

    As for your bug, I did not get your tessellation errors. Looking at your image though it does look like you have very high frequency noise, weird.

    I only use tessellation and not vertex position, are you using both? If yes, try tessellation only.

  17. #17
    0
    Champion
    Join Date
    Mar 2014
    Posts
    630
    Quote Originally Posted by berna View Post
    Hi!
    At the moment I'm fully busy on several things regarding Loading Human (including this shader) and a mobile game, so I can't really afford making a tutorial.
    But most important, I'm doing a lot of "trial and erros" with this ocean... trying to figure how things work, understanding what I really need and how to fulfill these needs.
    So a tutorial done right now will be a confuse mess of unsure things, and I'm afraid not very useful to you guys.
    By the way, I promise that I'll give you some guide when I'll find the right way to do this headcache-giver sea
    Thank you! Am looking forward to it, i know Epic sad they wanted to put this in the Marketplace, am sure they help you with what ever.

  18. #18
    0
    Quote Originally Posted by Handkor View Post
    I am also using GPUGems and I just changed my material to subtractions and yes the wave steepness seems more pronounced. It does look better. My normals on the other hand no longer matched my waves though.
    I think I should investigate more on this...

    Quote Originally Posted by Handkor View Post
    As for your bug, I did not get your tessellation errors. Looking at your image though it does look like you have very high frequency noise, weird.

    I only use tessellation and not vertex position, are you using both? If yes, try tessellation only.
    I'm using the "absolute world position" node to obtain the coordinates of the vertices and use as input for the wave calculation.
    After that, I plug the result in the W.P.Displacement connector only.
    It seem to be strictly related to the density of the original mesh.
    I use flat tessellation... here you can see the difference between adaptive tessellation OFF and ON on 2 planes... one with a lot of native vertices and the other low poly...
    Name:  adaptive_on.jpg
Views: 3751
Size:  219.7 KB

    In this picture I have adaptive tessellation turned off, but I show another strange things: an "odd" tessellation multiplier value gives me good results... an "even" value mess my mesh...
    Name:  adaptive_off.jpg
Views: 4570
Size:  219.2 KB

    I forgot to mention that using the W.P.Offset connector and using the original vertices only gives me a good result...

    A lot of strange behaviours......

  19. #19
    0
    So... after some days of reading (all these papers gave me dizziness! ) I changed another time my wave generation algorithm.
    I abandoned GPUGems way and turned to classical Gerstner equations (the same used in the Tessendorf paper and many others): I find them more understandable and most of all I was successful in finding clear relations between parameters.
    Now I only need to specify a main direction, the max wave height (or alternatively a wind speed in Km/h) and a steepness factor to have 4 different waves merged in one ocean.
    The overall look of the mesh seems good... and another great things is that I have no more problems with adaptive tessellation!!
    Now I should add normal maps and start adding again details like foam.

  20. #20
    0
    This looks awesome, very well done!

  21. #21
    0
    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


  22. #22
    0
    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!


  23. #23
    0
    Unreal Engine Support
    Join Date
    Apr 2014
    Posts
    635
    Wow! Fantastic job berna! The last video that you have shared is awesome. The foam on the crest of the waves really makes the scene come to life. Keep up the fantastic work!

  24. #24
    0
    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...

  25. #25
    0
    Mythic

    Join Date
    Apr 2014
    Posts
    2,225
    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!

  26. #26
    0
    Quote Originally Posted by DotCam View Post
    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?
    Hi DotCam!
    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.

  27. #27
    0
    Mythic

    Join Date
    Apr 2014
    Posts
    2,225
    Quote Originally Posted by berna View Post
    Hi DotCam! 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!

  28. #28
    0
    Quote Originally Posted by DotCam View Post
    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?
    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

  29. #29
    0
    Quote Originally Posted by berna View Post
    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

    Will you be sharing this material or perhaps putting it on the Marketplace?

  30. #30
    0
    Hi guys! I'm still alive!!

    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

  31. #31
    0
    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.

  32. #32
    0
    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.
    Last edited by Matt Cross; 09-12-2014 at 04:16 AM.

  33. #33
    0
    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!!

    Name:  ocean_new_01.jpg
Views: 2967
Size:  139.0 KB

    Name:  ocean_new_02.jpg
Views: 3376
Size:  153.7 KB

    Name:  ocean_new_04.jpg
Views: 3019
Size:  218.4 KB

    Name:  ocean_new_03.jpg
Views: 2958
Size:  148.9 KB

    Name:  ocean_new_05.jpg
Views: 2908
Size:  123.6 KB

  34. #34
    0
    Quote Originally Posted by James Barnette View Post
    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.
    At the moment it'all done in the material editor. I don't have in mind to use c++... Maybe in the future I'll add some blueprint for buoiancy, but I don't think in the near future.

  35. #35
    0
    Hi Berna,

    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 -
    https://software.intel.com/en-us/articles/real-time-parametric-shallow-wave-simulation?language=en

    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.

  36. #36
    0
    Quote Originally Posted by sameek4 View Post
    Hi Berna,

    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 ?
    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...

  37. #37
    0
    Quote Originally Posted by berna View Post
    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?

    Anyway, congrats on being a daddy !

  38. #38
    0
    Former Staff
    Join Date
    Sep 2014
    Posts
    577
    Looking fantastic! -Would like to see some "ocean spray" on and/or between the rocks though! (-As a finishing touch of course!)

  39. #39
    0
    Hi Berna,

    Your work here is really excellent, have you had any time to make more progress on this?

  40. #40
    0
    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!

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •