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

    Does anybody here have a file with the C++ code for the buoyancy? I was trying to implement it into my ocean, but I don't have an OceanManager blueprint like the one in Handkor's, with the code. Thanks.

    Comment


      Originally posted by Edkenway View Post
      Does anybody here have a file with the C++ code for the buoyancy? I was trying to implement it into my ocean, but I don't have an OceanManager blueprint like the one in Handkor's, with the code. Thanks.
      I have it all working in my project available for anyone to download and use in their games. Handkor has even gone so far as to provide some of the code needed for buoyancy, as well as the material displacement.

      In order to get this working in your project, look through the project and see which features you have and which you don't have yet. The code itself will not work in another project by just copy/paste, it needs to be modified to your projects API.

      I will be packaging the code as a plugin in a future release, but as of right now, it is very difficult to get working. Here's the download, all files are there.

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

      GitHub Link - https://github.com/UE4-OceanProject/OceanProject
      Last edited by DotCam; 03-12-2015, 03:20 PM. Reason: fixed broken link
      Free Community Ocean & Sky Project || Join us on Discord! || Trello Roadmap

      Comment


        BTW I'm not sure if anybody modified the ocean height method to fix this or that anyone even noticed but the height value returned for position (x,y) is not actually the height for the calculated point at (x,y). The full gerstner equation is not what is being solved in my code.

        The actual height value at a point is returning a height but also a x and y displacement. So using the height directly at x and y is inaccurate. I was eventually planning on fixing this to return true height of wave at x,y instead of the 3d displacement of point x,y. The difference is not that big but if you use large waves with a high steepness on a small object, you will see that object is floating in front of the crests. This is not really an issue for for boats as that are many wavelengths in size usually.

        A quick solution is to modulate the height value by how much it is displaced in the x,y plane giving you a tighter fit to the actual wave otherwise the true solution requires you to solve a parametric equation for each wave.

        Comment


          Has anyone seen this? https://www.youtube.com/watch?v=rnGi2rtnmVY

          He shares his code, looks really nice! would be great if it can get implemented with this project

          Comment


            Hello guys, I've been trying to tackle Handkor's bouyancy Tutorial for a while and glad that you guys made a community thread about this(Been stuck on the C++ forever to get the buoyancy working). I will be trying to add to your project with my own progress of adding patrolling boats that use an AI behavior tree. I already have flying AI down and would like to see if I can simulate the same effect on your Gerstner waves. If you need to reach me, please check out my YouTube Channel or message me. I would also like to ask for permission to use your community project in my video updates and of course I would provide a link to give you guys credit. I'm not much of a tutorial person, but I do provide quick rundowns of my blueprints so it can give people an idea of how I created my progress.

            Comment


              Originally posted by Handkor View Post
              BTW I'm not sure if anybody modified the ocean height method to fix this or that anyone even noticed but the height value returned for position (x,y) is not actually the height for the calculated point at (x,y). The full gerstner equation is not what is being solved in my code.

              The actual height value at a point is returning a height but also a x and y displacement. So using the height directly at x and y is inaccurate. I was eventually planning on fixing this to return true height of wave at x,y instead of the 3d displacement of point x,y. The difference is not that big but if you use large waves with a high steepness on a small object, you will see that object is floating in front of the crests. This is not really an issue for for boats as that are many wavelengths in size usually.

              A quick solution is to modulate the height value by how much it is displaced in the x,y plane giving you a tighter fit to the actual wave otherwise the true solution requires you to solve a parametric equation for each wave.
              I haven't yet but I did notice some objects floating in front of the crests, such as the Buoy mesh I have in the video posted earlier. I thought that having the separate test points each providing their own force would be enough to counteract that behavior, but doesn't seem to be in some cases. Thank you for mentioning this I completely overlooked that part, but it explains a lot, I will work on getting that fixed!


              Originally posted by kkhaial View Post
              Has anyone seen this? https://www.youtube.com/watch?v=rnGi2rtnmVY

              He shares his code, looks really nice! would be great if it can get implemented with this project
              Yes I have seen that one, and have played with it a bit over on ShaderToy.com. It is a really cool method of creating waves, but as you can see from the video it is way too slow to be used in a game. It could possibly work if it was optimized and used with a dynamic LOD system to reduce the complexity, but it is not something I plan to integrate into this project. Also the code is Copyright protected, not sure what licence it is under but the author would need to give you permission to use it in the engine.


              @Avolanty:

              Yes that is no problem! Feel free to create videos showing how it all works and any changes you make to it, it is a free project so no worries there. I added the request for a link back to this site for a specific situation that came up, but also wan't the viewers to get the latest version of the project, and/or get tech support on it.

              I'll leave it up to you whether to add it or not. It's not really a requirement, just more of a request really.

              Would be awesome if you can leave a link to your video here as well, would love to see it! And if you are able to add to the project that would be awesome as well! Look forward to seeing what you come up with
              Free Community Ocean & Sky Project || Join us on Discord! || Trello Roadmap

              Comment


                Alright, Ill be sure to let you know how it goes, I'm hoping that a vector movement with gravity is all I need, but I'm sure Handkor's buoyancy should do the trick, if not going to have to alter some settings.

                Comment


                  Originally posted by Avolanty View Post
                  Alright, Ill be sure to let you know how it goes, I'm hoping that a vector movement with gravity is all I need, but I'm sure Handkor's buoyancy should do the trick, if not going to have to alter some settings.
                  Have you downloaded the latest version of this project? It includes Handkor's code for the BuoyancyMovementComponent and has Buoyancy working correctly. If you haven't already downloaded it, give it a try, and/or compare it with yours.

                  Here's the link: <Link Removed - Now on GitHub>

                  GitHub Link - https://github.com/UE4-OceanProject/OceanProject
                  Last edited by DotCam; 03-12-2015, 03:20 PM.
                  Free Community Ocean & Sky Project || Join us on Discord! || Trello Roadmap

                  Comment


                    It doesn't have his older .h and .cpp, but I'm glad that you have advanced it so much. This will take me a while to configure everything. Good news is that I was able to merge my progress over to your demo. I have flying AI moving over the water patrolling and shooting at me. Now I just need to spend some time in Maya and make some warships to get the effect I want.

                    Oh here is my Channel, its a work in progress

                    https://www.youtube.com/watch?v=sUjgiNXWAEA
                    Last edited by Avolanty; 02-07-2015, 04:09 AM.

                    Comment


                      Hello folks this is very impressive work!

                      I am new to game dev, but one of my 'learning projects' is to make a stylised-simplified ocean - Im learning a lot from what you have done

                      My question is simple:
                      -setting up a material function to generate Gerstner waves I understand (thanks Handkor)
                      - In order to mimic bouyancy and have objects sliding down waves Id like to sample the wave height at points relative to the floating object's centre
                      - you do this in code, Im trying to do it in blueprints, so (heres the question)

                      Q how can you sample the output of a material function at specific points, in a blueprint?

                      Ive trawled the documentation and you would think that it would be a fairly common thing to do,
                      but I cant see it

                      i.e. return (property) from material function(MF_given) at (x,y)


                      The other way is to use a RenderTarget, I gather, but this is expensive

                      thanks for any help

                      Comment


                        Fingers crossed Click image for larger version

Name:	Destroyer.png
Views:	1
Size:	68.2 KB
ID:	1066119

                        Comment


                          OK got it floating now, you can see the patrolling ai in the back of the picture, now I just need to get it moving. This will probably take a while bear with me.
                          Click image for larger version

Name:	So far it floats.png
Views:	1
Size:	546.7 KB
ID:	1066124

                          Comment


                            Guys, terrific work!
                            I always liked looking at CG water

                            I'm sure you've seen this, but if you didn't, I think this guy did a pretty good job of the "ocean" touching beach effect
                            https://www.youtube.com/watch?v=u82fxXHBFhA

                            Great work, keep it up!
                            Last edited by eXtreme; 02-10-2015, 09:54 PM.

                            Comment


                              Hey DotCam,

                              I have been working on a senior project for college with an Aquarium. The work you have done is great, and I was wondering if you would be interested in my fish flocking c++ code as a contribution to this project. Over the last week I have implemented boids flocking into our team's ue4 project. My current code creates semi-realistic fish school behaviors. The code also allows you to create a "predator" fish, so the fish not only school, but are apprehended by predators and flee and re-group in a semi-realistic manner. I'll post a video showing my current progress tomorrow if I have time. If this would interest you at all let me know, I would love to be a contributor and further the ue4 community!

                              Comment


                                Here's my initial flocking implementation for your enjoyment, the video quality is ****, and the playback freaks out when I go above the water, but you get the gist of the flocking:

                                Comment

                                Working...
                                X