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
    Hey guys, just wanted to give you a little preview of what's coming "soon"

    Featuring:
    Destructible icebergs, drivable ships and cannons!.. b|tches love cannons! (I had to do this lol props to those who got the reference).

    Also network play and other ships (hint: pirate ships!) will also be included
    Awesome =3 Can't wait for this

    Comment


      Great for some reason this morning when I tried to use the "Launch unreal engine" button from the epic games launcher it forced and uninstall of 4.7.2 and install of 4.7.3, anyone know if the plugin works under 4.7.3 since I've now got 5 gigs to download? Gonna suck to have to download and compile 4.7.2 from github, takes forever to download and over an hour to compile even on my 6 core 4ghz cpu.
      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


        I'm on 4.7.3 and the plugin works just the same, relax :P

        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


          Great work you guys, all deserve a medal! I took a break from my main project to have some fun with this, suffice to say I'm looking forward to TK-Masters boat update!

          Click image for larger version

Name:	coolwater.jpg
Views:	1
Size:	446.9 KB
ID:	1071712

          Comment


            Originally posted by TK-Master View Post
            I'm on 4.7.3 and the plugin works just the same, relax :P
            Awesome TK your the man, it was just odd. I hit launch and bam, my engine folder is like 40mb and I cant open any project becauseof that obviously. I'm still waiting for it to installl. It stopped downloading about 25 minutes ago and hjas been stuck on 90% since.... bah!
            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 docjor View Post
              Great work you guys, all deserve a medal! I took a break from my main project to have some fun with this, suffice to say I'm looking forward to TK-Masters boat update!

              [ATTACH=CONFIG]33117[/ATTACH]
              That boat looks sick man!

              Comment


                ^^ Seconded. I opened your profile to make sure you didint have any WIP threads cause thaats a 2-3-4-5 hundred dollar model if its got textures. Talk about competition.
                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
                  ^^ Seconded. I opened your profile to make sure you didint have any WIP threads cause thaats a 2-3-4-5 hundred dollar model if its got textures. Talk about competition.
                  Hah! I don't think you have much to worry about there, I'm not giving up my day job any time soon. The ship and ocean script are going to be used in a little fun project, a la Codename Eagle!

                  Comment


                    Originally posted by docjor View Post
                    Hah! I don't think you have much to worry about there, I'm not giving up my day job any time soon. The ship and ocean script are going to be used in a little fun project, a la Codename Eagle!
                    You gotta be careful what you say on the internet I think you just gave me an idea for a title finally.

                    Edit: Hey I had a thought when I was testing something out.

                    If you bind a key to display your center of mass say (OnKeyX() { PrintString(GetCOM()) } or have it print it every second or so using a timeline or a delay tick and use this on a boat floating on the waves. The boats center of mass is offset depending on where the waves move it right? This makes sense on the surface due to the rocking but I was super confused that my COM was going down in the Z as my sub made a dive underwater and then I realized... cause the center of mass is now reading lower for whatever reason.

                    Any ideas on why this happens? My mesh? The plugin? In Unity (sorry) printing out the COM will be 0,0,0 no matter where it moves in the world, or a different reading if you offset it.

                    Did some more research: If I move the ocean to 0,0,0 and my boat to 0,0,0 I get a COM of 0,0,0 BUT since my root joint is +4500 in the X I get a COM reading of 0,0,0 but a transform.Location of 4500,0,0. Should I post a video of this? Its extremely weird why its happening and makes no sense as to why it should/is happening, TK/Dot/HK any comments?

                    The value changes are throwing my debugging off of anything with a buoyancy component.
                    When I think center of mass going to -xxxx in physics terms it makes it more "stable" against rolling because the weight of the object is physically lower than it visually is. For example in unity if I have a boat thats rolling way more than it should I just add in a simple statment rigidBody.centerOfMass = new Vector3(0,0,-10); to set the center of mass 10 meters below the origin of the rigidbody (the mesh).

                    And yes, I tested this with a cube two differnt ways 1) just a cube with physics dropping from the sky into the ocean the COM readout stays at 0,0,0. Add a buoyancy component with one test point at 0,0,0 the COM changes to reflect its translation from the world origin.

                    Its like as soon as you add the buoyancy component the COM changes to the world location of the root joint.

                    Edit2: We were able to get a nice boat sinking effect by having just certain test points slowly increase in density on a registred hit event, its not the most elegent solution, but it sure looks **** cool. I'll wait for avo to post a video or when we swap work next I'll take a video. Unfortunatly we are behind schedule now so.


                    Edit3: Well I made a giantic (some 100+ 5m tall 100m long cubes of alternating colors) depth guage to see how good the buoyancy system works underwater. After a 5 minute+, 2000 ft crash dive (way past crush depth, the depth at which the water pressure is greater than the steel can handle and the boat implodes) and it looking pretty horizontal to me right as its about to hit bottom. Albeit, its only with 4 test points as a tester, but puts more confidence in the system as a whole. The whole weird COM values from before still make no sense to me, but at least now I know I can trust my values, rather than my eyes/debug values (which is scary, not being able to trust debug values). When I get my new engine component built I'm going to build a bubble indicator (the bubble is what they use on a submarine to see how level the boat is, after a dive the divnig officer will say "level the bubble out at 500 feet" or something) that reads the pitch of the boat so that I can be 100% sure at all times since that shouldnt change with a buoyancy component added.... I hope.



                    Edit: Since I'm the last person posted still, lets not let this thread stagnate like the unity one has guys (I looked last night, no updates in 2 months and no real post in weeks or more). Dot have you talked to V.A. about joining forces? I was looking through some of old older code he definitly knows what hes doing.
                    Last edited by Nsomnia; 04-05-2015, 09:35 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




                      TK this is why we need your point density override for every test point. Its beautiful for stuff like this and pulls off a very realistic sinking. I tried this with Handkors, and it would not work as smoothly as yours.

                      Comment


                        Looks good Avolanty glad it works this smoothly.

                        @Nsomnia
                        Not sure if I understood what you mean with the CoM position but sounds like you are thinking that it has to do with the pivot point, which it doesn't.. the CoM depends on the collision mesh and it's calculated by physx so it has nothing to do with the pivot point.
                        The CoM offset is also an offset from the physx CoM (again not to be confused as an offset from the pivot point).

                        ----------------------------

                        Little status update on the ships:

                        So I have figured out a way to use complex collision (per poly) on the ships (for pawn collisions etc.) while at the same time use a secondary simple collision for ship-to-ship and ship-to-world physics collision.

                        The limitation here of course is that when using complex collision you can only have a one-way physics interaction.. meaning that you cannot have objects apply any kind of forces to it (hence why the buoyancy forces don't work) but the complex collision mesh is able to push the physics objects around.

                        Which is fine in this case since a pawn or a small rigid body wouldn't be able to apply any relevant amount of force to a large ship anyway.

                        Currently I'm working on networking the whole thing.. I have done some decent progress, I can have 2 or more players ride the same ship over LAN and seems to be synchronized just fine (although it's still questionable if it will work the same with actual network latency, I might need some testers to help me with that at some point) but I have a few other non-network related problems

                        I posted a question about one of the issues yesterday but I haven't gotten any reply yet.. if you can help with this or bump the thread that would be great!
                        https://forums.unrealengine.com/show...n-quot-%28-%29
                        Basically I can't find an easy way to have a player inherit the rotation of the ship he is standing on without doing some manual setRotation (which then in turn messes up the movement.. etc.)
                        Hopefully I won't have to rewrite the movement component just to fix this


                        And since I can't keep myself from posting pictures ().. here's a WIP screen of the ship example with complex collision that I'm working on.

                        (Click for larger size)

                        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


                          Ooh I saw something directly related to that issue TK I think I even bookmarked it. I'll see if I can find it in my 200+ bookmark "UE4" folder. Think it was something that I came across when I was looking into the best way to create a bridge (the part of the submarine lookouts stand on when surfaced on the top of the sail (superstructure) a player can walk on and inherit the boats rotation at all times since we are technically not possessing our ships as a "character", we will be controlling both at once most of the time. I'll see if I can remember the thread/answerhub link I had tomorrow morning.

                          In regards the CoM deal basically if I take a cube BP that prints its COM no mater where I place it it will always be at 0,0,0. In the air falling down. Static anwhere in the level. Underwater. Anywhere and the CoM = 0,0,0.

                          The second I add the buoyancy component it tells me the CoM is exactly the distance from its pivot point (0,0,0 in its local space) to the world origin (0,0,0 in world space) so it tells me the CoM has gone to -3000,1500,750 if I place the cube on the water 3000 units +x, -1500 Y and -750 Z. Strange is all. It hasnt caused any bugs yet, it just seems strange and I couldnt see anything in the code that would make that happen once the buoyancyComponent is added.

                          Another thing I was wondering. I was thinking of ways to use the GetWaveHeightValue function that is exposed to blueprints as a simpler depth checker among fancier ideas like faking bow waves and wakes and kelvin wake waves. What exactly does this node return?

                          I assumed it to be the height of the ocean mesh directly above whatever is referencing oceanmanger (so whereever the root component lies) on the frame its called but when I add it into my eventTick() loop with its target being OceanManager which its target is Buoyancy component then I set its location vector input as my meshes GetWorldLocation then I print its return vector in its individual X,Y & Z using a macro. When I dive my ship, or floating on the surface it reads 0,0,0. Could that be because I've got it to dead calm seas right now and thus no waveheight, or is this node just not useful in its current state?

                          Heres how I was using it (link cause its 1080p res) http://i.imgur.com/rlf2WDX.png
                          Last edited by Nsomnia; 04-06-2015, 07:59 PM.
                          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


                            so Dotcam how is your wave direction handled in the ocean manager - is it c++ , through the plugin or through the blueprints, reason im asking this is because i might fix up your wave direction, so that it can move into the center of the mesh to simulate wave directions when standing on a island or pushing out if someone is using this as a lake. also going to figure out how to simulate on how the mesh will determine the center points of multiple islands. because i noticed its looks good on one side, but the wave direction continues through the other side making it unrealistic
                            Last edited by Tea-Rexx; 04-06-2015, 09:55 PM.

                            Comment


                              Originally posted by Tea-Rexx View Post
                              so Dotcam how is your wave direction handled in the ocean manager - is it c++ , through the plugin or through the blueprints, reason im asking this is because i might fix up your wave direction, so that it can move into the center of the mesh to simulate wave directions when standing on a island or pushing out if someone is using this as a lake. also going to figure out how to simulate on how the mesh will determine the center points of multiple islands. because i noticed its looks good on one side, but the wave direction continues through the other side making it unrealistic
                              Look at the code with notepad++ or visual studio. I just happened to have this open still from examining GetWaveHeight... its not terribly hard to figure out if you know how to program in any language, its the Unreal API that confuses me a little.

                              Code:
                              AOceanManager::AOceanManager(const class FObjectInitializer& PCIP)
                              	: Super(PCIP) {
                              	MeshCenter = FVector(0, 0, 0);
                              	WaveDirection = FVector(0, 1, 0);
                              	WaveSpeed = 1.0f;
                              	GlobalWaveSettings = FWaveParameter();
                              	WaveSet1 = FWaveSetParameters();
                              	//WaveSet2 = FWaveSetParameters();
                              	PrimaryActorTick.bCanEverTick = true;
                              	EnableGerstnerWaves = true;
                              	}
                              
                              FVector AOceanManager::GetWaveHeightValue(FVector location) {
                              	//FVector sum = FVector(0, 0, 0);
                              
                              	// Flat ocean buoyancy optimization
                              	if (!EnableGerstnerWaves)
                              		return FVector(location.X, location.Y, RootComponent->GetComponentLocation().Z);
                              
                              	float time = GetWorld()->GetTimeSeconds() + NetWorkTimeOffset;
                              		
                              	return CalculateGerstnerWaveSet(GlobalWaveSettings, WaveSet1, FVector2D(WaveDirection.X, WaveDirection.Y), location, time * WaveSpeed);
                              	}
                              
                              FVector AOceanManager::CalculateGerstnerWaveSet(FWaveParameter global, FWaveSetParameters ws, FVector2D direction, FVector position, float time) {
                              	FVector sum = FVector(0, 0, 0);
                              
                              	// Calculate the Gerstner Waves
                              	sum += CalculateGertnerWave(global.Rotation + ws.Wave01.Rotation, global.Length * ws.Wave01.Length,
                              		global.Amplitude * ws.Wave01.Amplitude, global.Steepness * ws.Wave01.Steepness, direction, position, time);
                              	sum += CalculateGertnerWave(global.Rotation + ws.Wave02.Rotation, global.Length * ws.Wave02.Length,
                              		global.Amplitude * ws.Wave02.Amplitude, global.Steepness * ws.Wave02.Steepness, direction, position, time);
                              	sum += CalculateGertnerWave(global.Rotation + ws.Wave03.Rotation, global.Length * ws.Wave03.Length,
                              		global.Amplitude * ws.Wave03.Amplitude, global.Steepness * ws.Wave03.Steepness, direction, position, time);
                              	sum += CalculateGertnerWave(global.Rotation + ws.Wave04.Rotation, global.Length * ws.Wave04.Length,
                              		global.Amplitude * ws.Wave04.Amplitude, global.Steepness * ws.Wave04.Steepness, direction, position, time);
                              	sum += CalculateGertnerWave(global.Rotation + ws.Wave05.Rotation, global.Length * ws.Wave05.Length,
                              		global.Amplitude * ws.Wave05.Amplitude, global.Steepness * ws.Wave05.Steepness, direction, position, time);
                              	sum += CalculateGertnerWave(global.Rotation + ws.Wave06.Rotation, global.Length * ws.Wave06.Length,
                              		global.Amplitude * ws.Wave06.Amplitude, global.Steepness * ws.Wave06.Steepness, direction, position, time);
                              	sum += CalculateGertnerWave(global.Rotation + ws.Wave07.Rotation, global.Length * ws.Wave07.Length,
                              		global.Amplitude * ws.Wave07.Amplitude, global.Steepness * ws.Wave07.Steepness, direction, position, time);
                              	sum += CalculateGertnerWave(global.Rotation + ws.Wave08.Rotation, global.Length * ws.Wave08.Length,
                              		global.Amplitude * ws.Wave08.Amplitude, global.Steepness * ws.Wave08.Steepness, direction, position, time);
                              
                              	return sum / 8;
                              	}
                              
                              
                              FVector AOceanManager::CalculateGertnerWave(float rotation, float waveLength, float amplitude, float steepness, FVector2D direction, FVector position, float time) {
                              
                              	float frequency = (2 * PI) / waveLength;
                              
                              	FVector dir = FVector(direction.X, direction.Y, 0);
                              	dir = dir.RotateAngleAxis(rotation * 360, FVector(0, 0, 1));
                              
                              	float wavePhase = frequency * FVector::DotProduct(dir, position) + time;
                              
                              	float c = FMath::Cos(wavePhase);
                              	float s = FMath::Sin(wavePhase);
                              
                              	float QA = steepness * amplitude;
                              
                              	// Leaving this as a FVector to possibly extend it's usefulness to the BuoyancyMovementComponent (dir.X/.Y)
                              	return FVector(QA * dir.X * c, QA * dir.Y * c, MeshCenter.Z + amplitude * s);
                              	}
                              Its all handled c++ through the ocean manager. You can adjust some values via public properties from the details tab but none of these are UFUNCTION(BlueprintCallable). look at the header and .cpp file for the oceanmanager.
                              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
                                Look at the code with notepad++ or visual studio. I just happened to have this open still from examining GetWaveHeight... its not terribly hard to figure out if you know how to program in any language, its the Unreal API that confuses me a little.

                                Code:
                                AOceanManager::AOceanManager(const class FObjectInitializer& PCIP)
                                	: Super(PCIP) {
                                	MeshCenter = FVector(0, 0, 0);
                                	WaveDirection = FVector(0, 1, 0);
                                	WaveSpeed = 1.0f;
                                	GlobalWaveSettings = FWaveParameter();
                                	WaveSet1 = FWaveSetParameters();
                                	//WaveSet2 = FWaveSetParameters();
                                	PrimaryActorTick.bCanEverTick = true;
                                	EnableGerstnerWaves = true;
                                	}
                                
                                FVector AOceanManager::GetWaveHeightValue(FVector location) {
                                	//FVector sum = FVector(0, 0, 0);
                                
                                	// Flat ocean buoyancy optimization
                                	if (!EnableGerstnerWaves)
                                		return FVector(location.X, location.Y, RootComponent->GetComponentLocation().Z);
                                
                                	float time = GetWorld()->GetTimeSeconds() + NetWorkTimeOffset;
                                		
                                	return CalculateGerstnerWaveSet(GlobalWaveSettings, WaveSet1, FVector2D(WaveDirection.X, WaveDirection.Y), location, time * WaveSpeed);
                                	}
                                
                                FVector AOceanManager::CalculateGerstnerWaveSet(FWaveParameter global, FWaveSetParameters ws, FVector2D direction, FVector position, float time) {
                                	FVector sum = FVector(0, 0, 0);
                                
                                	// Calculate the Gerstner Waves
                                	sum += CalculateGertnerWave(global.Rotation + ws.Wave01.Rotation, global.Length * ws.Wave01.Length,
                                		global.Amplitude * ws.Wave01.Amplitude, global.Steepness * ws.Wave01.Steepness, direction, position, time);
                                	sum += CalculateGertnerWave(global.Rotation + ws.Wave02.Rotation, global.Length * ws.Wave02.Length,
                                		global.Amplitude * ws.Wave02.Amplitude, global.Steepness * ws.Wave02.Steepness, direction, position, time);
                                	sum += CalculateGertnerWave(global.Rotation + ws.Wave03.Rotation, global.Length * ws.Wave03.Length,
                                		global.Amplitude * ws.Wave03.Amplitude, global.Steepness * ws.Wave03.Steepness, direction, position, time);
                                	sum += CalculateGertnerWave(global.Rotation + ws.Wave04.Rotation, global.Length * ws.Wave04.Length,
                                		global.Amplitude * ws.Wave04.Amplitude, global.Steepness * ws.Wave04.Steepness, direction, position, time);
                                	sum += CalculateGertnerWave(global.Rotation + ws.Wave05.Rotation, global.Length * ws.Wave05.Length,
                                		global.Amplitude * ws.Wave05.Amplitude, global.Steepness * ws.Wave05.Steepness, direction, position, time);
                                	sum += CalculateGertnerWave(global.Rotation + ws.Wave06.Rotation, global.Length * ws.Wave06.Length,
                                		global.Amplitude * ws.Wave06.Amplitude, global.Steepness * ws.Wave06.Steepness, direction, position, time);
                                	sum += CalculateGertnerWave(global.Rotation + ws.Wave07.Rotation, global.Length * ws.Wave07.Length,
                                		global.Amplitude * ws.Wave07.Amplitude, global.Steepness * ws.Wave07.Steepness, direction, position, time);
                                	sum += CalculateGertnerWave(global.Rotation + ws.Wave08.Rotation, global.Length * ws.Wave08.Length,
                                		global.Amplitude * ws.Wave08.Amplitude, global.Steepness * ws.Wave08.Steepness, direction, position, time);
                                
                                	return sum / 8;
                                	}
                                
                                
                                FVector AOceanManager::CalculateGertnerWave(float rotation, float waveLength, float amplitude, float steepness, FVector2D direction, FVector position, float time) {
                                
                                	float frequency = (2 * PI) / waveLength;
                                
                                	FVector dir = FVector(direction.X, direction.Y, 0);
                                	dir = dir.RotateAngleAxis(rotation * 360, FVector(0, 0, 1));
                                
                                	float wavePhase = frequency * FVector::DotProduct(dir, position) + time;
                                
                                	float c = FMath::Cos(wavePhase);
                                	float s = FMath::Sin(wavePhase);
                                
                                	float QA = steepness * amplitude;
                                
                                	// Leaving this as a FVector to possibly extend it's usefulness to the BuoyancyMovementComponent (dir.X/.Y)
                                	return FVector(QA * dir.X * c, QA * dir.Y * c, MeshCenter.Z + amplitude * s);
                                	}
                                Its all handled c++ through the ocean manager. You can adjust some values via public properties from the details tab but none of these are UFUNCTION(BlueprintCallable). look at the header and .cpp file for the oceanmanager.
                                ah ok cool, ill have a look at it tonight, tho im still learning C++ but i know blueprints, might get a friend to help with this

                                Comment

                                Working...
                                X