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

    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
    Amazing.
    The only problem that I find in my tries with FFT is: "The water looks like it is not going anywhere".

    FFT:


    So I´ve changed to 2 combos of 8 gerstner waves + heightmap panners, to create this kind of "crisp messy".
    Last edited by Raziєl; 07-07-2016, 10:53 PM.
    YouTube:Coruja Games
    Twitter:@_corujagames
    Facebook:@corujagames
    Instagram:@_corujagames

    Comment


      Working on a fluid surface integration, but so far, i've been unsuccessful in getting the fluid surface component to work in the blueprint, without it crashing my GPU (every time this happens i need to restart windows.)

      But, I've applied the Ocean material to it, using the 'ultra' shader, and i got good results, I'll post results here when I can

      Comment


        Originally posted by Yoyomike View Post
        Working on a fluid surface integration, but so far, i've been unsuccessful in getting the fluid surface component to work in the blueprint, without it crashing my GPU (every time this happens i need to restart windows.)

        But, I've applied the Ocean material to it, using the 'ultra' shader, and i got good results, I'll post results here when I can
        I would not recommend using the fluid surface plugin.. unfortunately there are a lot of bugs with it and it's unstable.
        It's development was stopped a long time ago, it may have been updated for later engine versions but it was never "ready" in the first place.
        Someone would need to put in a lot of effort to improve it (I have tried, and failed ), but in my opinion it's not worth the time at this point.

        I have recently discovered that there are some ridiculously simple algorithms out there for making interactive water surfaces that work surprising well (and fast!).
        The cool part is that it can work even with a few lines of code! it's almost like magic.

        For example, MullerGDC2008 can be as simple as this:
        Click image for larger version

Name:	EIhBs.png
Views:	1
Size:	61.9 KB
ID:	1111700

        The problem with these kind of fluid simulations however is that they are a little too frame-rate dependent so it's nearly impossible (or not easy) to sync them in networked applications.
        For example, FFT and gerstner waves can be simulated for any arbitrary time value that will give the exact same result each time, which means you can simulate 86355131 frames ahead if you need to but this kind of fluid simulations are very different.. a simulation at 30fps will be 2 times slower than a simulation at 60fps for example.

        But for single player it can work well including buoyancy. Or as a rendering-only feature in multiplayer (no buoyancy, not accurately synced).
        I'm implementing something like this that will compliment the FFT simulation, I should have something demo-able soon.

        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
          I would not recommend using the fluid surface plugin.. unfortunately there are a lot of bugs with it and it's unstable.
          It's development was stopped a long time ago, it may have been updated for later engine versions but it was never "ready" in the first place.
          Someone would need to put in a lot of effort to improve it (I have tried, and failed ), but in my opinion it's not worth the time at this point.
          I agree the current implementation is not going anywhere, but I am proposing that we all as a community Start Over from the UE2 code provided by James Golding.

          Essentially that plugin got taken up by 1 person and went down 1 route, I feel like we should start over truly from scratch rather than trying to patch up what is currently around.

          Fluid Surface Plugin ~ Starting Over
          https://forums.unrealengine.com/show...l=1#post561546


          Please note I have great respect for this thread and what is happening here, and I am hoping that a recapitulation of that plugin could be helped out by all you awesome folks here in this thread, as a compatible game element to what you are doing.

          If any of the core folks in this thread dont like me mentioning this here let me know and I will remove it, but I am hoping we can resuscitate the poor Fluid Surface Plugin

          or

          Completely re-implement what it does in our own way, [MENTION=1127]TK-Master[/MENTION] ?



          Rama

          PS: Summary: omg I miss fluid surface ripples affected by moving characters from UE3/UE2
          Last edited by Rama; 07-08-2016, 06:11 PM.
          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


            I for one don't give a rat's (youknowwhat) about FFT, granted, it's great, looks nice, and all the more realistic, we're getting no closer to water that interacts with the world around it.

            I for one wouldn't mind a water surface which interacted with the actors movements, the rocks it crashes up against, and the particles that hit it (rain and snow, hail and etc).

            Rather than a beautiful water shader that has no immersive effect what so ever, apart from being nice to look at.

            I wish we'd all have the same beautiful vision for the Engine, fluid surfaces that make the player feel attached to the world they're playing in, as opposed to static scenes that feel like a painting more than anything else. But to each their own, everyone is entitled to their own dreams, it is really sad to me that fluid surface is just a dream that most of us don't share, to my knowledge.

            With all that said, If I knew anything about coding, I'd jump right in and start fluid surface from the beginning, but I don't, and I'd probably make it worse. Truth is, it's PERFECTLY fine aside from the fact you can't integrate it into blueprints, and you can't put it inside a landscape / or another static mesh.


            But in any way I can help at all, Rama, consider me all for this notion.
            Last edited by Yoyomike; 07-09-2016, 08:25 AM.

            Comment


              I find contrary to regular game development water needs performance before mechanics. How many fps do you get with 120 gertner sums. Guess it depends of you need weather or gently lapping. Good to see Rama slowly unreal'ing himself to death in one more thing

              Triton has rotor/propr wash, wakes, object-water interaction, etc. and is used in some military sims... pretty sure they started right with FFTs due to the massive speed of waveform calculations. That said a waveform is a waveform no matter how its generated... to a degree.

              Edit: on their website they quote "Over 65,000 individual waves at over 500 frames per second" thats alot of [performance] room you have to throw extra features on top. Although they use the gpu for a lot more computational speed its possible to do if everyone throws in what they got working when they do.

              DC, dont forget bitbuckets free private git repos, rama is a much more appealing contributor than myself
              Last edited by Nsomnia; 07-09-2016, 08:49 AM.
              Tek LLC a personal Candaian Company running BlenderTek & UnrealTek is currently looking for help to bring back submarine simulator gaming with a new genre of sub sims: Cold War! (1945-1991) Operation: Trident SubSim Dev Diary Thread - Donations

              Comment


                Originally posted by Rama View Post
                I agree the current implementation is not going anywhere, but I am proposing that we all as a community Start Over from the UE2 code provided by James Golding.

                Essentially that plugin got taken up by 1 person and went down 1 route, I feel like we should start over truly from scratch rather than trying to patch up what is currently around.
                I'm already making good progress



                It currently runs on the CPU, the performance is not that great with grids > 256x256 as you can expect but it's totally acceptable at lower resolution grids (it's also possible to multi-thread it, so it should be even better).
                The video showcases 2 different propagation algorithms that I found. The waves can reflect from walls or custom obstacles btw!

                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
                  I'm already making good progress

                  The waves can reflect from walls or custom obstacles btw!
                  Omg!

                  Wohooo! Thank youuuuu [MENTION=1127]TK-Master[/MENTION]!

                  So ahm

                  hee hee

                  I um, well, any sense of when I can play with this?

                  Will it be something that is part of the entire ocean project or a separate plugin?

                  If you ever wanted to consider it as a paid plugin I know many would buy it

                  You could also present this to Epic as a PR, a replacement for the fluid surface plugin initiative, something James Golding really wanted in the Engine

                  If you'd like any coding involvement on my part just let me know!



                  Rama
                  Last edited by Rama; 07-09-2016, 06:11 PM.
                  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 TK-Master View Post
                    I'm already making good progress



                    It currently runs on the CPU, the performance is not that great with grids > 256x256 as you can expect but it's totally acceptable at lower resolution grids (it's also possible to multi-thread it, so it should be even better).
                    The video showcases 2 different propagation algorithms that I found. The waves can reflect from walls or custom obstacles btw!
                    Is that the fluid surface actor you seemed so bleak about yesterday :O?

                    Comment


                      What are the chances of getting this to work in an HTML5 project? I tried to cook it but it choked on the plugin.
                      Last edited by mach7monkey; 07-11-2016, 09:40 AM.

                      Comment


                        Hello I try to make landscape modulation work I selected landscape and heightmap I exported from landscape in ocean details, but it makes no difference as you can see:

                        Click image for larger version

Name:	d2f665aa44.jpg
Views:	1
Size:	362.5 KB
ID:	1111928

                        Here is the heightmap, shore is actually quite flat, but i think it should still work.

                        Comment


                          I'm having trouble getting the same underwater effects that's in dcSkyTestMap and UnderwaterFish in 4.12.5. I created a new project, copied the Plugins folder into project folder and Ocean, ShipsAndExamples, and Sky folders into the Content folder, created a new empty level, dragged the BP_Ocean, BP_Underwater, and BP_Sky blueprints into the scene then deleted them. Then I copied BP_Ocean, BP_Sky, BP_Underwater, PP_Global and WaterSwimVolume from dcSkyTestMap and into my level but they didn't all copy until I migrated the map into my project. Then they copied but there are no underwater effects.

                          I also tried as directed in the instructions using the OceanExampleMap_01 but I think they're a little outdated. I couldn't find everything in the example map that I was supposed to copy, and it looks like the lights and heightfog are no longer needed in the new sky bp. I've tried other combinations as well to no avail. The only way I could get it to work was to rename the files and contents in source of OceanProject to my project name, generate VS files and compile it that way. This gave me all of the effects I was looking for but every time I tried to add a new class, the editor crashed.

                          Also, when I plug in latitude and longitude for Kennedy Space Center (28.58N, 80.65W), the sun and moon both show up at 10. And if I check the Allow Daylight Savings box and hit play, the sun immediately goes down.

                          And finally, I tried switching to a first person pawn and when I hit play, the sky gets darker. Changing the sun's brightness had no effect. But what's really weird is if I walk (max speed of 600), it stays that way, but if I run (shift+w and max speed at 1000), it brightens up until I stop and then gets dark again.

                          Not sure what I'm missing or doing wrong... any ideas?

                          Comment


                            Originally posted by speedpacer View Post
                            I'm having trouble getting the same underwater effects that's in dcSkyTestMap and UnderwaterFish in 4.12.5. I created a new project, copied the Plugins folder into project folder and Ocean, ShipsAndExamples, and Sky folders into the Content folder, created a new empty level, dragged the BP_Ocean, BP_Underwater, and BP_Sky blueprints into the scene then deleted them. Then I copied BP_Ocean, BP_Sky, BP_Underwater, PP_Global and WaterSwimVolume from dcSkyTestMap and into my level but they didn't all copy until I migrated the map into my project. Then they copied but there are no underwater effects.

                            I also tried as directed in the instructions using the OceanExampleMap_01 but I think they're a little outdated. I couldn't find everything in the example map that I was supposed to copy, and it looks like the lights and heightfog are no longer needed in the new sky bp. I've tried other combinations as well to no avail. The only way I could get it to work was to rename the files and contents in source of OceanProject to my project name, generate VS files and compile it that way. This gave me all of the effects I was looking for but every time I tried to add a new class, the editor crashed.

                            Also, when I plug in latitude and longitude for Kennedy Space Center (28.58N, 80.65W), the sun and moon both show up at 10. And if I check the Allow Daylight Savings box and hit play, the sun immediately goes down.

                            And finally, I tried switching to a first person pawn and when I hit play, the sky gets darker. Changing the sun's brightness had no effect. But what's really weird is if I walk (max speed of 600), it stays that way, but if I run (shift+w and max speed at 1000), it brightens up until I stop and then gets dark again.

                            Not sure what I'm missing or doing wrong... any ideas?
                            The issues with underwater effects will be caused by not having a Post Process actor in the scene with the Blendables PP material in the Misc section (and make sure the PP volume is "UnBound"), check the implementation of the PP_Global actor in the demo level. Also make sure you migrate everything in the Sky & Ocean folder, along with the ShipsAndExamples\CustomThirdPerson\Blueprints folder at a minimum if you want both the ocean and skydome.

                            The brightening issue will also be caused by the PostProcess volume, expand the Settings, then the Auto Exposure section, and set both the Min & Max Brightness values to 1. This disables the brightening effect when looking at bright then darker areas and vice versa.

                            For the moon, believe it or not, the moon is quite often visible in the daytime (how else could you get a solar eclipse mid day?). We don't notice it as much because it blends into the atmosphere, it doesn't stand out like it does at night, but it is there. You can check the values against this website, MoonCalc.org, or any others such as the US Navy's site. Just enter in your long/lat date/time, then compare the Azimuth (yaw) and AltitudeAngle (pitch) values. Please note that the end Rotator pitch/yaw/roll will not be the same as Azimuth & AltitudeAngle, they need to be rotated into UE4 coordinates causing a discrepancy. Be sure to adjust the time/date in the Default section, the moon and sun positions vary from one day to the next, most days the moon stays below the horizon during the day, but not all.

                            One last thing to keep in mind, the Offset UTC variable needs to be accurate for your longitude location. As an example I live in Vancouver Canada, which is roughly -130 longitude, and a UTC hour offset of -8. The east coast is -5 hours UTC, make sure you have that set properly. I am not sure what might be causing the issue with Daylight Savings time but I will look into it further.

                            I will update the documentation asap with the migrating instructions, and get back to you on the other info asap.

                            --------------------------
                            [MENTION=63257]Mordraug[/MENTION]:
                            Please take a look at this answer from TK a little while back, the texture needs to be a certain size to work properly:
                            https://forums.unrealengine.com/show...l=1#post553893

                            --------------------------
                            [MENTION=15485]dazuk1978[/MENTION] / [MENTION=320632]jSlavens[/MENTION] / [MENTION=234985]ppouloup[/MENTION]

                            I am sorry for not replying to your PM's yet, I have not been doing very well for the last couple weeks, I will try and get back to you asap

                            --------------------------
                            [MENTION=1127]TK-Master[/MENTION]

                            Same as above, haven't been around much lately, but I'll try again tomorrow Your fluid surface actor looks great! It's probably a lot of fun to play with too hey? Nice work man!
                            Last edited by DotCam; 07-12-2016, 07:24 PM.
                            Free Community Ocean & Sky Project || Join us on Discord! || Trello Roadmap

                            Comment


                              Thanks for the quick response! Sorry to hear you're not doing well. I'll give all these things a whirl.

                              I do know that the sun and moon are often both above the horizon... I guess it just looked odd being so prominent, maybe too close. I didn't really dig into it that much because I was having these other issues but I'll take a look at it again when have a chance.

                              Thanks again.

                              Edit:
                              Originally posted by DotCam View Post
                              The issues with underwater effects will be caused by not having a Post Process actor in the scene with the Blendables PP material in the Misc section (and make sure the PP volume is "UnBound"), check the implementation of the PP_Global actor in the demo level. Also make sure you migrate everything in the Sky & Ocean folder, along with the ShipsAndExamples\CustomThirdPerson\Blueprints folder at a minimum if you want both the ocean and skydome.
                              Hey DotCam, I haven't had a chance to look at the other stuff yet, but I had migrated all of those folders over and copied the PP_Global actor over from the demo project already and verified they all had the same settings between our two projects, several times before I reached out, and everything looked okay, but I just checked again under the Blendables section in PP_Global to make sure and there is 1 element pointing to /Game/Ocean/Materials/M_Underwater_PP_Inst and it's set to 1, priority of 0.0, Blend radius of 100 (greyed out), Blend weight of 1.0, enabled and Unbound. It's all of the same settings in the dcSkyTest map of OceanProject. I have both M_Underwater_PP_Inst and M_Underwater_PP in my project and I don't see anything unusual jumping out at me in those. I believe it can be reproduced.

                              Any other ideas?
                              Last edited by speedpacer; 07-13-2016, 07:05 AM.

                              Comment


                                Originally posted by DotCam View Post
                                Please take a look at this answer from TK a little while back, the texture needs to be a certain size to work properly:
                                https://forums.unrealengine.com/show...l=1#post553893
                                I saw that post, but heightmap I use for ocean is exactly the same heightmap I use for landscape so it should be ok. Right?

                                Comment

                                Working...
                                X