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 reneberwanger View Post
    Man. Review your code. At some point its exact the same Math. (8 Waves / 8 is an example) At end of all you return is a Vector 3. And then repeat the same Math on Material. That I asking why is Equal and done 2 times.
    Like I said.. you can't do all the math on the CPU because not only you would need to pass thousands of vector parameters (one per vertex) which is ridiculous and not possible but also doing the calculations on the GPU is a lot faster.

    Originally posted by reneberwanger View Post
    I cant use my own skydome? I think its because the caustics right?
    You can! you will just have to copy the blueprint part which updates the sun vector to your own skydome (I will try and post more details on that later). It's fairly easy to do.

    Originally posted by reneberwanger View Post
    Also, I believe that calculations based on heightmap are unnecessary if I could using vertex painting.
    Again, you can't do that because the vertex painting is based on the mesh UVs but since the mesh is constantly being moved and scaled by the infinite system (and therefore the UVs) you can't use vertex painting so you would have to either make something like a larger static ocean plane or use a similar technique which is used for the landscape heightmap (it's basically a texture mapped in world space really).

    Originally posted by reneberwanger View Post
    Why you don't use materials functions on Ocean Material? That is a material that only you 2 can understand now.
    I would like to further optimize and simplify the material at some point of course but that's not high priority for me.

    Originally posted by reneberwanger View Post
    I asked Dotcam if you need help several times and I was ignored. I can help especially in the artistic part. No offense, but I think the look of the ocean can be improved. Even send solution to the problem of intersecting objects, using Distance Field AO.

    .. I really think it was a great job done here. But I think you should focus on clean and optimize, instead of increasing the features. And I really can help.
    DotCam is not ignoring you on purpose or anything he has not been active for quite some time due to health problems (he had complications with his back surgery), I haven't talked him since September or so so unfortunately I have not any recent information.

    Distance field foam and displacement is on my to-do list.

    Everyone is welcome to contribute to the project of course!
    You can make a pull request, post snippets of your material or pm me.

    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
      Like I said.. you can't do all the math on the CPU because not only you would need to pass thousands of vector parameters (one per vertex) which is ridiculous and not possible but also doing the calculations on the GPU is a lot faster.
      This Code is not this Formula? With features to Rotate?

      Click image for larger version

Name:	013equ01.jpg
Views:	3
Size:	26.2 KB
ID:	1103947


      If I plug the result of this code on a Displacement pin inside material, the plane will not have ONE WAVE?
      Code:
      FVector AOceanManager::CalculateGerstnerWaveVector(float rotation, float waveLength, float amplitude, float steepness, const FVector2D& direction, const FVector& position, float time, FWaveCache& InWaveCache, bool CalculateXY, bool CalculateZ) const
      {
      	float frequency = (2 * PI) / waveLength;
      
      	FVector dir;
      	if (!InWaveCache.GetDir(rotation, direction, &dir))
      	{
      		dir = FVector(direction.X, direction.Y, 0);
      		dir = dir.RotateAngleAxis(rotation * 360, FVector(0, 0, 1));
      		dir = dir.GetSafeNormal();
      		InWaveCache.SetDir(rotation, direction, dir);
      	}
      
      	float wavePhase = frequency * FVector::DotProduct(dir, position) + time;
      	float c = 0, s = 0, QA = 0;
      
      	//FMath::SinCos(&s, &c, wavePhase);
      
      	if (CalculateXY)
      	{
      		c = FMath::Cos(wavePhase);
      		QA = steepness * amplitude;
      	}
      
      	if (CalculateZ)
      	{
      		s = FMath::Sin(wavePhase);
      	}
      
      	return FVector(QA * dir.X * c, QA * dir.Y * c, amplitude * s);
      }
      YouTube:Coruja Games
      Twitter:@_corujagames
      Facebook:@corujagames
      Instagram:@_corujagames

      Comment


        Originally posted by reneberwanger View Post
        If I plug the result of this code on a Displacement pin inside material, the plane will not have ONE WAVE?
        You mean run that code on the CPU and then pass the result in the material via a vector parameter?

        If so then no! that won't work of course.. that would compute the displacement for only one position not for all vertices (each vertex has it's own world position so the calculations needs to be done per vertex).

        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
          You mean run that code on the CPU and then pass the result in the material via a vector parameter?
          If so then no! that won't work of course.. that would compute the displacement for only one position not for all vertices (each vertex has it's own world position so the calculations needs to be done per vertex).
          Look the parameters of Wave function... Unless the "ABSOLUTE WORLD POSITION" node, is "per vertex" not by object.


          I Will try at night.
          Last edited by Raziєl; 04-06-2016, 02:00 PM.
          YouTube:Coruja Games
          Twitter:@_corujagames
          Facebook:@corujagames
          Instagram:@_corujagames

          Comment


            Okay I know that I'm not the best at explaining things but.. **** you are gonna drive me mad lol xD I think you are confused about a few things

            And yes, absolute world position gives the position of the vertex in this case.

            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
              And yes, absolute world position gives the position of the vertex in this case.
              So here is my confusion then. Solved.

              So, with that at each frame, the "material" will run all the code on nodes for each vertex, in something like that sequence?
              Click image for larger version

Name:	PgiWgIW.jpg
Views:	1
Size:	29.1 KB
ID:	1103960


              Originally posted by TK-Master View Post
              **** you are gonna drive me mad lol xD I think you are confused about a few things
              Sorry for that. I'm that kind of guy that know how to make some things, but don't know why.
              Last edited by Raziєl; 04-06-2016, 02:20 PM.
              YouTube:Coruja Games
              Twitter:@_corujagames
              Facebook:@corujagames
              Instagram:@_corujagames

              Comment


                Yes, it basically does a "for loop" through all vertices and computes whatever you plug into world displacement for each individual vertex.

                Absolute world position will return the vertex position when something is executed in the vertex shader (world displacement) or the pixel position (always in world space) if it is executed in the pixel shader (diffuse, normal, roughness etc.).

                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


                  Is there still a blueprint only version of this (even if it isn't fully featured for the sake of performance)?
                  Last edited by Crafty; 04-06-2016, 04:44 PM.

                  Comment


                    So the source code compiles fine under 4.11 who was working on shaders can you please PM or post what needs to be fixed and what youve fixed so I can get started on that.
                    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 Nsomnia View Post
                      So the source code compiles fine under 4.11 who was working on shaders can you please PM or post what needs to be fixed and what youve fixed so I can get started on that.
                      Here you go.

                      These are still for the Gaussian DOF only, I plan to update everything else that needs to use the custom depth (like Bokeh DOF, atmospheric fog etc. I believe the new capsule shadows would need that as well to work on the ocean) but I don't know when I will find time to do that .
                      Attached Files

                      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


                        I have issue, i when i change color of directional light and sky light and hit build lighting it resets...

                        Comment


                          Hey, this is a great project. Thanks a lot for the time it took to make it. A quick question, though. How do you get the fog effect under the water? I've tried to dissect the provided level and it seems to be a part of the BP_ocean actor. However, I've copied it's variables and setup identically in my own level and there are no PP effects or fog under the water. What am I missing? I've spent 3 hours trying various things to no avail. Thanks for your time,

                          Adam

                          Comment


                            Originally posted by AdamMacDon View Post
                            How do you get the fog effect under the water? I've tried to dissect the provided level and it seems to be a part of the BP_ocean actor. However, I've copied it's variables and setup identically in my own level and there are no PP effects or fog under the water. What am I missing?
                            Yeah this seems to be confusing a lot of people
                            You most likely haven't enabled the stencil buffer in your project since it's disabled by default.

                            Edit > Project Settings > Rendering > Custom Depth-Stencil Pass = Enabled with Stencil

                            I recommend that you read a few pages back next time when you have issues like this, you might often find the answers you are looking for.

                            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
                              Here you go.

                              These are still for the Gaussian DOF only, I plan to update everything else that needs to use the custom depth (like Bokeh DOF, atmospheric fog etc. I believe the new capsule shadows would need that as well to work on the ocean) but I don't know when I will find time to do that .
                              I'll work on what I can and compare the old shaders to the new and see what happens, im not a shader expert especially when it comes to HLSL shaders versus GLSL,
                              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


                                Thanks for the help, but I tried that already and it made no difference. I have read 4 or so pages back and the first couple pages as well, and none of the posts have solved this issue for me. Very curious indeed. Any other things I could be missing?

                                Comment

                                Working...
                                X