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

    Hmm seems you are right about the performance.

    I opened an old project of mine from 4.4 and did some stress testing on gerstner waves..


    Don't pay attention to the fps from the video, it's all wrong because of fraps .. the actual fps difference was from about 130fps to about 85fps which is a big performance hit actually but keep in mind each crate from the video was simulating 64 test points (so about 1000 points total)! which is an exaggeration, normally you would need 4 points each.

    An optimization that I can think of is to not run the buoyancy when the object is not near the water (by adding volume(s) roughly surrounding the ocean parts) but that's not going to help for objects that are actually in the water :\
    Another option could potentially be to run the calculations with CUDA but that means no AMD support etc.

    At the end of the day I think you would indeed have to reduce the number of gerstner waves if you really need to simulate many buoyant objects but if we are talking about a single ship or boat for example then at least that should be perfectly fine
    Last edited by TK-Master; 01-18-2015, 03:23 PM.

    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


      Originally posted by TK-Master View Post
      Hmm seems you are right about the performance.

      I opened an old project of mine from 4.4 and did some stress testing on gerstner waves..

      Don't pay attention to the fps from the video, it's all wrong because of fraps .. the actual fps difference was from about 130fps to about 85fps which is a big performance hit actually but keep in mind each crate from the video was simulating 64 test points (so about 1000 points total)! which is an exaggeration, normally you would need 4 points each.

      An optimization that I can think of is to not run the buoyancy when the object is not near the water (by adding volume(s) roughly surrounding the ocean parts) but that's not going to help for objects that are actually in the water :\
      Another option could potentially be to run the calculations with CUDA but that means no AMD support etc.

      At the end of the day I think you would indeed have to reduce the number of gerstner waves if you really need to simulate many buoyant objects but if we are talking about a single ship or boat for example then at least that should be perfectly fine
      Wow that's not bad at all, it's great to see it can be done!

      So obviously I must have a bug in this somewhere. I also allow the user to fully customize the waves using a blueprint that feeds values to the code OceanManager. I have a feeling the code is doing a re-init on the wave values before doing the calculations... I don't know how else to explain this performance hit.

      Thank you for the video, it is reassuring to know that this is possible to do at a good framerate. The migrating process completely broke my ocean system BP, but almost finished putting it back together now, will upload asap!
      Free Community Ocean & Sky Project || Join us on Discord! || Trello Roadmap

      Comment


        Absolutely amazing man! Quick question I might had overlooked it or migrated it odd is the weater (rain) in the current download? I am just wondering. I am loveing what I am seeing and it works and looks amazing on 4.6.1, also would you have any issues if my team used it in our Fighting Game we are working on? We are a small indie company but Unreal and Mixamo (Animation software and protoyping software which is a godsend atm) has been following us on my Twitter and the FanPage we have on FB since our main site is under construction. I would give full credit and if I was able to add anything to it I would have no problem sharing. We are currently in early Alpha stages but we are working on having it release for PC/PS4/XboxOne. Once again freaking amazing job man. I am at a loss for words.
        Demented owner and founder of NeoSpawn Games
        Current Project: Project Yami (place holder title) Next-Gen Fighter using UE4
        FanPage: www.facebook.com/NeoSpawnGames
        Official(under construction): www.neospawngames.net
        Personal FB: http://www.facebook.com/Keiyentai
        LinkedIn Profile: http://www.linkedin.com/in/Keiyentai

        Comment


          @TK-Master - I am going to PM you with the code in a zip, migrating to a new project is causing a ton of errors... Every time I get one fixed another pops up... So it is going to take some more time to get it running (looks like I need to redo it again today, map errors...) :/


          @Keiyentai - The rain needs to be attached to the player itself so I didn't hook it up properly, but have a look in the Sky\ParticleFX folder, there is a "P_Rain_Test" particle. It is basically one of the waterfalls from the Cave Effects demo that has been enlarged to look more like rain. I will have a better example included soon, just have to get buoyancy working first.

          You are more than welcome to use it in any project you'd like (this goes for anyone wanting to use it in their project!), and If you are able to improve it in any way that would be most welcome as well! Good luck with your game, and keep us updated!
          Free Community Ocean & Sky Project || Join us on Discord! || Trello Roadmap

          Comment


            PM sent! I think I may have found the source of the performance hit (fingers crossed)

            By the way, have the shader changed in any significant way? can I use the currently uploaded shader with the code you sent me? from a quick look the parameters seem the same, just making sure
            Also, have you already implemented a way to synchronize the ocean manager parameters with the material instance?

            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


              Originally posted by TK-Master View Post
              PM sent! I think I may have found the source of the performance hit (fingers crossed)

              By the way, have the shader changed in any significant way? can I use the currently uploaded shader with the code you sent me? from a quick look the parameters seem the same, just making sure
              Also, have you already implemented a way to synchronize the ocean manager parameters with the material instance?
              Hey thanks for looking it over! Unfortunately I tried your code but it did not have a noticeable impact, and seems that I need it to remain a FVector for the angular rotation of the buoyant object, but I did all this rather quickly so I may have missed converting a variable type. I have kept all of the changes and converted them to comments so I can give it another try later. But it did confirm for me there are no issues with the speed of the code, so thank you for that! I'm doing some profiling to see if I can figure this out, comparing with the version I released before, I'm starting to think I may have overlooked something in the material/blueprints. Something is amiss here the FPS is way too low...

              The shader hasn't had any breaking changes since it uses a MaterialParamterCollection which allows you to add and remove easily without much concern, so that shouldn't be a problem. But the BP_OceanSystem is using the wrong Parameter sets, I moved them to code (in OceanManager.h) so I could easily access them from both BP/code. To fix this up you need to do is add a variable of WaveParameter (no 's' on the end, that one is BP based and has been removed) for the global (median) settings and 2 WaveSetParameters for WaveSet1/WaveSet2, then a variable for holding the BP wrapper of the OceanManager code (regular BP using OceanManager as it's base class but otherwise empty, I called it OceanController), and finally pass the parameter variables to it in the ocean BP. To pass them to the material as well I replaced the previous params with the new ones, split WaveSetParameters output nodes from the 2 wave sets and break the WaveSetParameter values for each wave, then plug each float into a "Make Color" node to transfer them to each value in the MaterialParameterCollection.

              Obviously that is not all that simple of a fix, and is really boring work splitting all connecting up those structs. I'll get this out asap for you guys, working on the 2nd attempt at migrating right now as I'm as profiling the main project!
              Free Community Ocean & Sky Project || Join us on Discord! || Trello Roadmap

              Comment


                Hey DotCam, I was wondering if there's a way to create the OceanManager without having to use any code?

                Comment


                  Hey guys. Cool thread. Have you seen this explanation of how they went about dealing with the ocean in AC3? Pretty interesting read.

                  Comment


                    Ok, I have some good news and some incredibly awesome news for you guys! First the incredibly awesome news:

                    Performance is no longer an issue

                    I found the bug, fixed it and now get 120fps with multiple buoyant objects, as shown here:



                    The good news? I'm just finishing up that buoyancy sneak peek right now, and will upload shortly.


                    @EdKenway - Yes it is possible, and there is a nearly completed version of it in the Ocean folder of the download. It is called "OceanManager" as well, and has everything needed to get it working. It can't just be hooked up and used as is, it needs a bit more work, I may look into that in the future now that I have the code version working.

                    @InMind - Yes I found that article as well recently, it has a lot of good info in it! Now that buoyancy is working I will be exploring it further, especially the way they transition between the shore and open ocean. They use a variant of Gerstner waves along with a Fast Fourier Transform (FFT) generator to add more dimension to the waves. I re-installed AC Black Flag a couple of weeks ago and I will be using it as a reference going forward, they did a really good job on the waves it's really impressive, I hope this system will one day look the same. Thanks for mentioning it though, any other interesting articles you come across, be sure to send them my way!
                    Free Community Ocean & Sky Project || Join us on Discord! || Trello Roadmap

                    Comment


                      Ok here is the "Early Adopters" version of the OceanDemo with buoyancy. I am currently working on a tutorial for how to create your own buoyant objects and will add it here soon. It is fairly easy though, check out one of the Buoy's blueprint Components section, all you need to do is add a BuoyancyMovementComponent and add a "Test Point" to each corner of the object. 4 is pretty standard but a boat will need more (currently working on getting a small boat working).

                      Here is the Preview of version 2 - With Working Buoyancy
                      <Link Removed - Now on GitHub>

                      GitHub Link - https://github.com/UE4-OceanProject/OceanProject

                      *Note: I don't mind any of you using this in any project for UE4, and have no problem with any videos being created demoing it's functionality. Only thing I ask for videos is you link back to this thread. Thanks!
                      Last edited by DotCam; 03-12-2015, 03:29 PM.
                      Free Community Ocean & Sky Project || Join us on Discord! || Trello Roadmap

                      Comment


                        Looking fantastic! Great work on the buoyancy - I'm tuning it a bit right now. Will contribute back for comments when done.

                        For those wondering about performance, I'm seeing 94.6 fps on a Core i7/4790k + GTX 970 @ 1342mhz, with the buoys and cylinders in the frame. About 96fps with just water in frame - so very little hit from the buoyancy model. Amazing!

                        Comment


                          Oh nice job DotCam! looks like you beat me to it, I finished adding my buoyancy code to your ocean yesterday and I put together a few objects of various shapes and densities.. here is a video showing it
                          Also added a pirate ship for good measure! Check it out


                          Btw, did you figured out what was causing the performance hit? it all runs the same to me, the buoyancy barely has any impact on performance if you use few test points.

                          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


                            Originally posted by TK-Master View Post
                            Oh nice job DotCam! looks like you beat me to it, I finished adding my buoyancy code to your ocean yesterday and I put together a few objects of various shapes and densities.. here is a video showing it
                            Also added a pirate ship for good measure! Check it out

                            Btw, did you figured out what was causing the performance hit? it all runs the same to me, the buoyancy barely has any impact on performance if you use few test points.
                            That looks awesome man!!! really cool, is that for a game or just a fun project? I may ask you a couple of questions later, but also if you ever want to collaborate on this project as well it would be awesome!, or let me know in PM!

                            And yes - The Performance issue has been completely resolved, I now get 120+ FPS (Capped at 120) Even With all of the object shown in my video above!!!

                            It was totally unrelated to the ocean itself, let's just say its fixed and leave it at that (ie Dumb Mistake)
                            Last edited by DotCam; 01-21-2015, 07:25 PM.
                            Free Community Ocean & Sky Project || Join us on Discord! || Trello Roadmap

                            Comment


                              Thanks it's just a fun/practice project atm but eventually I'm totally going to make a game with some sort of sailing in it

                              I would love to collaborate on this, if there is some way I can help let me 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


                                Anyone who is interested in water should definitely check out the Twitch stream today with Alan Willard:

                                https://forums.unrealengine.com/show...22-2015-2PM-ET
                                Twitch /unrealalexander| Twitter @UnrealAlexander
                                How to report a bug? | Installation & Setup issues?
                                Call me to a thread by posting this: [MENTION]Alexander Paschall[/MENTION]

                                Comment

                                Working...
                                X