Announcement

Collapse
No announcement yet.

[Community Project] WIP Weather & Ocean Water Shader

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    I have been analyzing different water conditions on certain areas of a region and noticed that sometimes water can change considerably, for example, when entering a bay or channel. One interesting idea would be a volume that overrides the settings so we could make configs for different areas - like bays, channels, coastline, deep ocean without having to relay on weird tricks with scenario to change to different water meshes.
    My Portfolio/Resume: www.chaosforcestudio.wix.com/portolio
    One of my projects: www.chaosforcestudio.wix.com/sonicevolution

    Comment


      There is a performance problem or something somewhere that give me 60FPS even in the UnLit Mode with a 780GTX
      Hevedy - Instance Tools: https://hevedy.itch.io/hevedyinstances
      Hevedy - Image Tools: https://hevedy.itch.io/imagetools

      Comment


        Originally posted by Rama View Post
        [MENTION=5439]DotCam[/MENTION] [MENTION=1127]TK-Master[/MENTION]

        Wow! This offering of yours is tremendous! Thank you thank you!

        I am sorry I am only just noticing this thread for the first time

        I tried it out and I especially loved the breaking up of waves along the shoreline, your landscape feature. The buoyancy and Gerstner waves are great, tho personally I think of them as DotCamWaves

        This is one awesome community contribution, thank youuuu!



        Rama
        Hey Rama That means a lot, coming from you

        Originally posted by Hevedy View Post
        There is a performance problem or something somewhere that give me 60FPS even in the UnLit Mode with a 780GTX
        That's probably because of the planar reflection component.
        I would say it's best to switch back like it was before with SSR (for now) until I add my custom planar reflection system which is better

        4.10 Update! -> [Community Project] WIP Weather & Ocean Water Shader
        WIP Interactive Water Shader, WIP 2D Water Sim
        WIP FFT Ocean w/ Foam, Quad-tree Infinite Ocean LOD

        Comment


          FFT-based Ocean Simulation WIP!

          So after a lot of headaches and red bulls (sponsor me please? lol) I finally have a working FFT implementation.

          Test #1.

          (Don't pay too much attention on the material look, this is meant to showcase the displacement)

          This is simulating a 128x128 grid on the CPU at about 4ms on a separate thread.
          The plan is to implement a GPU-CPU combo for maximum performance and quality.
          The CPU will simulate a smaller FFT (up to 128) which will be used for height readback queries only (for buoyancy etc.) and the GPU will be able to simulate a larger grid (up to 2048) with normals, energy-based foam etc. which will be used for rendering.

          The simulation above is using the classic Phillips spectrum from the tessendorf papers which produce nice sharp "choppy" waves and is meant to represent a fully developed open ocean state, but there are other spectrum models out there (which I have partially implemented) that are more "physically correct" and can produce different style of waves.

          There is still a lot of work to be done so don't expect any of this to be released anytime soon, I'm doing this in my free time as you know

          4.10 Update! -> [Community Project] WIP Weather & Ocean Water Shader
          WIP Interactive Water Shader, WIP 2D Water Sim
          WIP FFT Ocean w/ Foam, Quad-tree Infinite Ocean LOD

          Comment


            Well done now excuse the idiot but what's FFT? My life is surrounded with acronyms and this one is making my day.

            Comment


              Originally posted by TK-Master View Post
              FFT-based Ocean Simulation WIP!

              So after a lot of headaches and red bulls (sponsor me please? lol) I finally have a working FFT implementation.

              Test #1.

              (Don't pay too much attention on the material look, this is meant to showcase the displacement)

              This is simulating a 128x128 grid on the CPU at about 4ms on a separate thread.
              The plan is to implement a GPU-CPU combo for maximum performance and quality.
              The CPU will simulate a smaller FFT (up to 128) which will be used for height readback queries only (for buoyancy etc.) and the GPU will be able to simulate a larger grid (up to 2048) with normals, energy-based foam etc. which will be used for rendering.

              The simulation above is using the classic Phillips spectrum from the tessendorf papers which produce nice sharp "choppy" waves and is meant to represent a fully developed open ocean state, but there are other spectrum models out there (which I have partially implemented) that are more "physically correct" and can produce different style of waves.

              There is still a lot of work to be done so don't expect any of this to be released anytime soon, I'm doing this in my free time as you know

              WOW [MENTION=1127]TK-Master[/MENTION] ! Astonishing work! I knew you were up to something... so quiet lately but I never imagine it would be this! wow. I can't contain my enthusiasm :-P my congrats! Keep it up!

              Comment


                Originally posted by Themanwithideas View Post
                Well done now excuse the idiot but what's FFT? My life is surrounded with acronyms and this one is making my day.
                FFT stands for fast Fourier transform.

                It's widely used in movies (pretty much every movie where there is a CG ocean) and in AAA titles such as assassin's creed and GTA5.

                wiki quote:
                "The FFT algorithm computes the discrete Fourier transform (DFT) of a sequence, or its inverse. Fourier analysis converts a signal from its original domain (often time or space) to a representation in the frequency domain and vice versa."

                The inverse FFT transforms a spectrum from the frequency domain which would look something like this:
                Click image for larger version

Name:	images.jpg
Views:	1
Size:	13.9 KB
ID:	1111446

                ..to a heightfield in the spatial (image) domain which looks something like this:
                Click image for larger version

Name:	heightfield.jpg
Views:	1
Size:	36.3 KB
ID:	1111447

                In more simple terms it basically lets you compute the sum of several hundred thousands of waves

                4.10 Update! -> [Community Project] WIP Weather & Ocean Water Shader
                WIP Interactive Water Shader, WIP 2D Water Sim
                WIP FFT Ocean w/ Foam, Quad-tree Infinite Ocean LOD

                Comment


                  Thanks a lot, DotCam.
                  It seems PhysX supports IOS, and we tried cutting off Apex features, repackage, this time it worked except for some material node errors during cook time.
                  Theoretically, if we ues animation or material system to simulate apex features and rewrite some unsopported material nodes, we can port the project to IOS. Am I right? Any suggest about that ?

                  Comment


                    Originally posted by TK-Master View Post
                    FFT-based Ocean Simulation WIP!

                    So after a lot of headaches and red bulls (sponsor me please? lol) I finally have a working FFT implementation.

                    Test #1.

                    (Don't pay too much attention on the material look, this is meant to showcase the displacement)

                    This is simulating a 128x128 grid on the CPU at about 4ms on a separate thread.
                    The plan is to implement a GPU-CPU combo for maximum performance and quality.
                    The CPU will simulate a smaller FFT (up to 128) which will be used for height readback queries only (for buoyancy etc.) and the GPU will be able to simulate a larger grid (up to 2048) with normals, energy-based foam etc. which will be used for rendering.

                    The simulation above is using the classic Phillips spectrum from the tessendorf papers which produce nice sharp "choppy" waves and is meant to represent a fully developed open ocean state, but there are other spectrum models out there (which I have partially implemented) that are more "physically correct" and can produce different style of waves.

                    There is still a lot of work to be done so don't expect any of this to be released anytime soon, I'm doing this in my free time as you know
                    Its obviously amazing work, but I miss the foamy water on the top where the waves crush, you know what I mean :P?

                    Edit: Ignore my post. I made the mistake by not reading the text just watching the video x_X. You are working on it and its great! <3
                    Last edited by Jenyer Jiyoon; 07-04-2016, 04:46 PM.

                    Comment


                      Originally posted by Rama View Post
                      [MENTION=5439]DotCam[/MENTION] [MENTION=1127]TK-Master[/MENTION]

                      Wow! This offering of yours is tremendous! Thank you thank you!

                      I am sorry I am only just noticing this thread for the first time

                      I tried it out and I especially loved the breaking up of waves along the shoreline, your landscape feature. The buoyancy and Gerstner waves are great, tho personally I think of them as DotCamWaves

                      This is one awesome community contribution, thank youuuu!



                      Rama
                      Thanks Rama, let us know if you have any issues and/or suggestions!

                      Good to hear from you as always, have fun with it!
                      Free Community Ocean & Sky Project || Join us on Discord! || Trello Roadmap

                      Comment


                        Hey [MENTION=5439]DotCam[/MENTION] I have been playing a bit with your new skydome, shouldn't the sun at the north pole never set around 21th June? It's pitch black at 20:00 for me...sounds a bit early for a midnight sun. Maybe I did something wrong? I used 90º for the latitude, and 0 for longitude (but longitude shouldn't matter much for the poles). I might very well have done something wrong so please forgive me if so :P
                        Last edited by DavidNSilva; 07-05-2016, 01:09 PM.

                        Comment


                          Originally posted by DavidNSilva View Post
                          Hey [MENTION=5439]DotCam[/MENTION] I have been playing a bit with your new skydome, shoudn't the sun at the north pole never set around 21th June? It's pitch black at 20:00 for me...sounds a bit early for a midnight sun. Maybe I did something wrong? I use 90º for the latitude, and 0 for longitude (but longitude shouldn't matter much for the poles). I might very well have done something wrong so please forgive me if so :P
                          Thank you for pointing that out! Had not tested that far north/south.

                          The reason that is happening is I fade out the sun once it "should" be below the horizon (when it's hour angle is less or greater than 110 degrees) and create a variable named Sun Height that get's passed to the material, reduces sun brightness, increases moon brightness, and fades in the stars.

                          Obviously (it's obvious to me now at least ) that isn't going to work properly, and not just at the poles, it's not adjusting the value by latitude at all. I actually just created a new function to get the exact sun rise/set times which is needed for the skylight & TOD settings blend, should work well for this issue too. I'll try switching it over to the new function soon, but for now I'll see if multiplying the value based on latitude (0-1 scale) is feasible. Might be a quick fix, will let you know asap.
                          Free Community Ocean & Sky Project || Join us on Discord! || Trello Roadmap

                          Comment


                            Well going extremes is usually the easiest way to find bugs :P Thank you very much, Santa Claus will be pleased to know. I hope you're feeling better, wish you all the best.
                            Last edited by DavidNSilva; 07-05-2016, 01:58 PM.

                            Comment


                              Originally posted by TK-Master View Post
                              FFT-based Ocean Simulation WIP!

                              So after a lot of headaches and red bulls (sponsor me please? lol) I finally have a working FFT implementation.

                              Test #1.

                              (Don't pay too much attention on the material look, this is meant to showcase the displacement)

                              This is simulating a 128x128 grid on the CPU at about 4ms on a separate thread.
                              The plan is to implement a GPU-CPU combo for maximum performance and quality.
                              The CPU will simulate a smaller FFT (up to 128) which will be used for height readback queries only (for buoyancy etc.) and the GPU will be able to simulate a larger grid (up to 2048) with normals, energy-based foam etc. which will be used for rendering.

                              The simulation above is using the classic Phillips spectrum from the tessendorf papers which produce nice sharp "choppy" waves and is meant to represent a fully developed open ocean state, but there are other spectrum models out there (which I have partially implemented) that are more "physically correct" and can produce different style of waves.

                              There is still a lot of work to be done so don't expect any of this to be released anytime soon, I'm doing this in my free time as you know
                              Oh my!

                              Do let me know when this does get released, but of course please proceed at the pace that is fun for you!

                              That CPU read for height info is especially important for my intended use cases

                              I'll be waiting to hear more about this!!!



                              Rama

                              Originally posted by DotCam View Post
                              Thanks Rama, let us know if you have any issues and/or suggestions!

                              Good to hear from you as always, have fun with it!
                              Rock on DotCam!



                              Rama
                              100+ UE4 C++ Tutorials on the UE4 Code Wiki, including UE4 Multi-Threading!

                              UE4 Marketplace: Melee Weapon Plugin & Compressed Binary Save System Plugin | Rama's C++ AI Jumping Videos | Vertex Snap Editor Plugin

                              Visit www.ue4code.com to see lots of videos about my C++ Creations! ♥ Rama

                              Comment


                                Originally posted by DotCam View Post
                                Hi there,

                                We have done a lot of work trying to get that plugin to play nicely with the ocean project, and it is (partly) possible to do. The problem isn't so much performance, but rather hard driver crashes when using it. A small grid is not too expensive to render, but using both the ocean waves and the fluid surface on a large scale is. Here's a video I made to show [MENTION=1127]TK-Master[/MENTION] it was working with this project a while back:



                                As you can see the grid is pretty small, anything larger than that and my video drivers would crash both UE4, and Windows too in some cases.

                                There is something in the code that doesn't work properly on DX11 (my best guess since it was ported from an older version), triggering a crash after a few minutes of use (with Nvidia drivers at least, I have a 980). I would really appreciate any help, if anyone can find out how to get it working properly I would gladly implement it fully into the project. It is very complex though, requiring C++ and HLSL shader code, which is why it has been backlogged for now. Both the FluidSurface actor and FFT are advanced techniques we are in the process of exploring further.

                                Thanks

                                EDIT: The error message you are getting just means the plugin code needs to be recompiled for your version of the editor. I wouldn't recommend using the code provided from that thread anyways, there have been major changes to the rendering engine since that project was abandoned. I have a working copy (as of 4.9) in my git repo list, but that too may require further changes to get it working correctly with ver 4.11 or 4.12.
                                REALLY glad you're working on the fluid surface actor, absolutely stoked to see this integrated, and I'm sure a lot of other people are, this is really the only thing standing between us and Crynengine, and EPIC knows it.

                                IF there's a way you can find to stop the hard driver from crashing ( I tried integrating it myself and ran into that issue, is there a way to to turn off wave displacement, and just have the blueprint there for changing material params?

                                Comment

                                Working...
                                X