Announcement

Collapse
No announcement yet.

Physical Ocean Surface - Developing a Realistic Water Shader

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SUBMITTED] Physical Ocean Surface - Developing a Realistic Water Shader

    This shader is now available on the Marketplace!
    You can find the documentation in the wiki.
    Here is a link to the support thread.

    Below the told WIP post:

    The last few months I have been working on a water shader, mainly to learn shader programming. All my work has been focused on getting a realistic surface motion. I'm now at a point where the surface is starting to look liquid enough for my taste.
    Since I don't have a real use for the shader, I want to make it available on the Marketplace once it's finished.



    Click image for larger version

Name:	snap_small_text.jpg
Views:	2
Size:	83.4 KB
ID:	1176332

    Click image for larger version

Name:	foam_text.jpg
Views:	2
Size:	80.7 KB
ID:	1179085

    Click image for larger version

Name:	AltArt_text.jpg
Views:	2
Size:	45.5 KB
ID:	1179091




    For the next video, I replaced the water material in the Vehicle Game example with my water shader:





    I use the JONSWAP wave spectrum to generate parameters for Gerstner waves. The user needs to provide two parameters as input: Wind speed and fetch. From these parameters, the corresponding JONSWAP spectrum is created and used to sample Gerstner wave parameters (this part is not implemented outside of UE4). The list of wave parameters is imported into UE4 and used as input for the Gerstner equations.

    The advantage of this approach is that you automatically get physically correct Gerstner wave parameters. No matter which wind speed and fetch you chose as input, you will always get a good looking surface motion.
    I've implemented the dispersion relation for gravity-capillary waves, so it is possible to generate large ocean waves or small capillary waves with wavelengths of millimeters or anything in between. The motion will always be correct.

    Is anyone interested in having this released?
    I think I can provide an ocean surface that works out of the box. Just place it in your map, set the values for wind speed and fetch and you will get surface motion like you see in the video above. There is still a lot of work to do, but I think it can be done.

    To do / feature list:
    • Automatic buoyancy for simple objects DONE
    • Automatic buoyancy for arbitrary objects DONE
    • Read Gerstner wave parameters from csv file DONE
    • Generate library of csv files with wave parameters for different combinations of wind speed and fetch length DONE
    • Make the water plane follow the camera to simulate an infinite ocean DONE
    Last edited by Theokoles; 05-12-2016, 12:39 AM.

    #2
    I think this would be great if you released it!
    Marketplace Assets

    Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
    Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
    Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

    Comment


      #3
      I have improved the look of the surface. This video has foam and a normal map for fine surface details.

      Comment


        #4
        Amazing!! Are you planning to release it in marketplace or for free?

        Comment


          #5
          If you're interested in working on it and don't mind releasing it then why not?

          I'd enjoy it =]

          Comment


            #6
            Originally posted by Kheka View Post
            Amazing!! Are you planning to release it in marketplace or for free?
            My current plan is to submit it to the marketplace.
            The most important feature that still needs to be implemented is an easy way for the user to change the wind speed and fetch values that are used to generate the waves. Right now the wave paramaters need to be manually imported into the blueprint.
            I also want to allow tweaking the quality of the surface motion. This will affect the number of individual Gerstner waves that are summed up to create the effect. In the videos above, 170 Gerstner waves are summed up with periods varying from 8 seconds to 0.5 seconds. I think that the number of waves can be reduced quite a bit while still looking good.

            Comment


              #7
              Are you going to do the underwater treatment as well? Caustics?

              I think what we're all looking for is something similar to GTA V's water.

              Good work!
              Last edited by Kridian; 05-10-2015, 11:02 AM.
              GTX 980 Ti · Intel i7 3770k @ 4.6ghz

              Comment


                #8
                At the moment transparency is not implemented.
                In the video below a different normal map is used to create fine surface details. I will try to replace this normal map with capillary Gerstner waves in the future. The video also has improved water color and shows sun reflections.
                I'm using the BlendAngleCorrectedNormals node to blend the Gerstner normals and the the additional normal map, but this turns out to be quite expensive. I will explore other ways to blend the normals to improve performance.

                Comment


                  #9
                  I have implemented a first version of buoyancy (at the moment only a single point is evaluated for each object). Buoyancy is implemented as a component, this means that you can drag any static mesh into the level, add the Buoyancy component like this:

                  Click image for larger version

Name:	component.PNG
Views:	1
Size:	20.4 KB
ID:	1076433

                  and the object will float:



                  The Buoyancy component automatically calculates the center of gravity of the object and makes it move with the water surface.

                  Here is a large screenshot because Youtube compression eats all the detail:

                  Click image for larger version

Name:	sun7.jpg
Views:	2
Size:	481.3 KB
ID:	1076439
                  Last edited by Theokoles; 05-15-2015, 12:11 PM.

                  Comment


                    #10
                    Looks awesome! Would it be optimal for this system to be place around a open world map, or is it too performance heavy?

                    Comment


                      #11
                      Originally posted by alanconrad View Post
                      Looks awesome! Would it be optimal for this system to be place around a open world map, or is it too performance heavy?
                      I agree this is really great but could you implement an LOD system so we can use it in bigger scenes with a larger view distance?

                      Comment


                        #12
                        Originally posted by alanconrad View Post
                        Looks awesome! Would it be optimal for this system to be place around a open world map, or is it too performance heavy?
                        I think it could be possible, but it's difficult for me to say how good the performance is because my graphics card is quite old. I have a XFX RADEON HD6870 Black Edition. Using a water plane with 32000 triangles and 16000 vertices, I get 25 fps in worst case at 1920x1080 resulution and epic quality settings when I launch the level in full screen. Please keep in mind that I have done barely any performance optimizations.

                        Originally posted by CyberDev View Post
                        I agree this is really great but could you implement an LOD system so we can use it in bigger scenes with a larger view distance?
                        Yes, I will make the water look good from large view distances.

                        Comment


                          #13
                          the appearance is good but the flow do not look naturally

                          Comment


                            #14
                            Hey, will it be released soon? Or a demo?

                            Comment


                              #15
                              Yes looks good, for starting. But know the heavy things, a nice shore with foam and reflections.
                              Just sayin ^^

                              Comment

                              Working...
                              X