[Community Project] WIP Weather & Water Shader

The mass is being effected by your add impulse however. I believe it depends on the type of BP you are using and its physics type. See if you put it to kinematic then its completely ignores all of your test points and the mass of the object and sets a default test point to the center/pivot just like you are saying but you cant adjust any values for the test points they are completely ignored. We however wanted to influence the test points individually so we set the physics type to default. of course acts with the mass of the object against your add impulse. Double check what type of BP object you our using, pawn, actor? Then try increasing the mass of the object and make sure your physics type is set to pawn or physics actor I believe. I also don’t think you notice the effect of mass on your objects because your probably using objects that don’t have much mass to begin with.

Interesting I would like to see that, I feel like it would help us out to examine another way for the physically-based approach.

Has anyone noticed that increasing cloud opacity removes visibility of the mesh from underneath? Happy to take a look at it if no one if working on that…

What commit are you using? I’ll look into it.

Heres my tiny contribution I whipped up tonight in my spare time a simple bearing indicator that reads 360 aka 0 degrees for north (+Y) all the way around any pawns rotation. Just add to your content folder, built for a first person character template just switch your gamemode hud to 1PHUD (had to make a new one has my other hud had a ton of prototyping in it). Hope helps people who get aggrivated trying to figure out why it switches from positive to negative values or from -90 to 180 or 270 etc. The get rotation node used here seems to be ā€œmissedā€ a lot.

Its really easy heres an example and the blueprint, create a horizontal box on your canvas then add 3 text boxes to it. The first one "Bearing: " the next one anything I use ā€œ000ā€ and bind it to a function built as below and the last one the degree symbol. Then on your HUD class blueprint (like the 1PHUD.uasset blueprint from the .rar) add a ā€œadd widgetā€ node with owning player set to get owning player controller node and choose compass class and then add to viewport and connect blue to blue and execute to execute. can be used as a readout like it is or to make a simple compass. I’ll show you how to use it to build a simple GUI compass with a rotating needle if there is interest; I’m just keeping the high-quality stuff to myself lol.

http://www.blendertek.com/Compass_Content.rar - download


Heres the blueprint, again if anyone really wants it I can, or anyone can convert it to C++ really easily. Tried to keep the width under 1000px if its too wide I’ll link it.


Show off any simple stuff you guys feel comfortable sharing that has to do in anyway with the /ships/exploration etc. were decimating Unity’s approach to a community plugin.

A fun thing to do is to do the same thing on enemy boats to make an easy way to calculate angle off bow (your bearing from the enemys ship that you enter into your torpedo firing computer) but, I dont think anyone else is developing a subsim. I saw one guy was, but he quit just like else. Were the last indie subsimmers standing except WoTA on Unity and hes been going 4 years with only 1 trailer for mobile. Not a single tech demo or anything.

Head of branch - steps to reproduce:

  1. Set cloud opacity up (e.g. 3), so you can see the clouds
  2. Go under the water mesh
  3. Look up

Will attempt to reproduce now. So people know

Tk’s branch with his alternate buoyancy system… buoyancycomponent now takes into effect density of object, density of water, and radius of test point. Now you can say make it the density of steel, or wood to get different . The density is measured in grams per cubic centimeter (g/cm3) and the forumla to calculate force (since for handkors, its a little more complicated)




Edit: I noticed in TK's dev branch that the sun sets in +Y which makes north +X (which it should be) so my bearing indicator/compass preview above is off by 90 degrees if you use it. If anyone doesnt know how to change that I'll post the new one, its very simple. Now we have proper light that rises in the east and sets in the west. That should be in the  branch if it isnt already (maybe I accidently rotated my entire skybox in my projects? lol)

			/**
			* --------
			* Buoyancy force formula: (Volume(Mass / Density) * Fluid Density * -Gravity) / Total Points * Depth Multiplier
			* --------
			*/


Here is the foruma for depth multiplier



			float DepthMultiplier = (waveHeight - (worldTestPoint.Z + _SignedRadius)) / (TestPointRadius * 2);
			DepthMultiplier = FMath::Clamp(DepthMultiplier, 0.f, 1.f);


_Signed radius goes as follows _SignedRadius = FMath::Sign(GetGravityZ()) * TestPointRadius; ]

It also apparently can draw debug spheres as yellow above water blue below.



			FColor DebugColor = FLinearColor(0.8, 0.7, 0.2, 0.8).ToRGBE();
			if (isUnderwater) { DebugColor = FLinearColor(0, 0.2, 0.7, 0.8).ToRGBE(); } //Blue color underwater, yellow out of watter
			DrawDebugSphere(GetWorld(), worldTestPoint, TestPointRadius, 8, DebugColor);


sic [water] TK :wink:

TK was nice enough to comment his work extremely well, he must be like me, has more lines of comments than code. Heres most of the header file with comments incase people want to know more, if you dont want your public source shown TK just let me know.


	/* Density of fluid */
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Buoyancy Settings")
	float MeshDensity;

	/* Density of water */
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Buoyancy Settings")
	float FluidDensity;

	/* Linear damping when object is in fluid */
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Buoyancy Settings")
	float FluidLinearDamping;

	/* Angular damping when object is in fluid */
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Buoyancy Settings")
	float FluidAngularDamping;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Buoyancy Settings")
	FVector VelocityDamper;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Buoyancy Settings")
	bool ClampMaxVelocity;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Buoyancy Settings")
	float MaxUnderwaterVelocity;

	/* Radius of the points */
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Buoyancy Settings")
	float TestPointRadius;

	/* Test point array. At least one point is required for buoyancy */
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Buoyancy Settings")
	TArray<FVector> TestPoints;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Buoyancy Settings")
	bool DrawDebugPoints;

BuoyancyMovmentComponent is stil the same as Handkors latest version as of writing and destructable buoyancy uses Handkors technique as well It looked like.

If anything is wrong TK let me know, just very few people actually look at the code to see how it works.

Heres an idea (which I’ll be incorporating into my game for both density and for sonar (sound travels faster the colder it gets cause its more dense) anways, the density of fluid at temperature would make it that 0.01% more accurate :wink:

Anyways, wood you would find on an old wooden ship was arround 6.75-7.20 g/cm3 in desnity. Water is 1 salt water is 1.03gĀ·cm3 (due to different heavy water isotopes not found in fresh water) plastics are generally around 1.1-1.12gĀ·cm3 cast iron is generally around 77.5gĀ·cm3 and steel is about 78.0gĀ·cm3 sometimes as high as 80.5gĀ·cm3 if its a high quality steel with different alloys and depending on its carbon content I believe I was taught standard mild steel is said to be 7.88gĀ·cm3. Titanium, which Russians used to build a submarine hull once weighs 4.506 gĀ·cm3. Ps you can also write these values out at g/cc (cubic centimeter). Air, if you need to simulate that, varies a ton depending on water content, co2/nitrogen/o2 content etc. altitude and temperature. Its average value is 0.001225 gĀ·cm3.

Edit: In TK’s dev the sun now sets in the west and rises in the east just like in real life. If isnt in the branch I would add it (maybe I rotated my skybox by accident in all my projects? lol) anyways, that throws my little compass/bearing indicator off because I was using +Y was north and +y is now west. +X is the new North, just like it would be. If you cant figure out how to fix that, let me know I’ll post how to fix the bearing indicator or include it when I show how to make a basic needle compass.

Edit2: I didnt realize there was a ā€œsun axis offsetā€ variable. set to -90 to make it rise in the east and set in the west aka proper north in the +X. Then get rid of -90 in my BP script (I think, I cant visualize code from blueprints, I’d have to try it. You want to face straight +x and get 0 aka 360 bearing though.

In regardings to the cloud opacity I see what your talking about. Remember is all very alpha/pre-alpha. The only work around I can think of is a value of 0.99 or so but the clouds still dont get less opaque with depth. I can easily show you how to do that in BP if you dont know how to do it yourself? That way you can make it so say 10m underwater they are gone, and above that they get more and more opaquie all the way to the stock 2.12 value. They sky actually seems to be getting lighter the lower you go, that seems backwards, but I’m using TK’s branch to reproduce not the .
I dont know if I should be saying (if not, let me know :wink: but weather/atmosphere update is supposed to be coming weekish.

A very cool idea thank you!

To package a game with the plugin you need to add a code file to your project, even if it is totally empty (sounds silly I know, hopefully will not be necessary in 4.8). To do so click on File -> Add Code to Project and choose either Actor or Blank, and give it a name that is not in use (you can’t use your projects name for example). will create the source files along with a *.sln file that you can use to view everything in VS if you’d like, but that’s not required.

Once you have added your new code you should now be able to package the project without any issues. Let me know if you run into any problems though! :slight_smile:

I have noticed as well. It shouldn’t be happening since the Translucency Sort Priority for each mesh has been set properly (unless something went wrong when I migrated the skydome from another project), I will have a look at it again morning before updating the branch. The clouds as they are now will be much different once Skydome overhaul has been completed, I’m currently testing out a couple new ideas and may end up removing the current cloud-dome mesh in favor of a new one. More on that soon, still testing. :slight_smile:

Oh there’s more! At last count there were 9 of us either working on or with the project (probably a lot more than that, that’s just the ones who have mentioned it so far). :wink:

And thanks for the Compass! I’ll add it in morning :slight_smile:


One last note:

Also just wanted to say that I will be merging in TK’s () new additions into today, along with a few other small fixes. Will let you guys know when it’s up, I may even create a 1.1 branch since there are so many new features. Should be up soon

Well. The whole copy and paste didnt work. I’m not gonna dive too hard into yet. Handkors solutions is working for us. Just TK’s is much more realistic. I get error, no code errrors just a runtime error? I’ve never coded without debugging and outside the standard libraries before. For anyone whos wondering, I’m trying to take TK’s buoyancy system and have it work like handkors where the location, radius, and buoyancy (which will just be the meshDensity… fluidDensity will be a global variable) can be set on a testpoint-by-testpoint basis so that you can ā€œfloodā€ parts of damaged ships or build submarines like we are.



1>------ Build started: Project: OceanDemo, Configuration: Development_Game x64 ------
1>  Parsing headers for OceanDemo
1>  Reflection code generated for OceanDemo
1>  Performing 17 actions (3 in parallel)
1>  PCH.UELinkerFixups.UELinkerFixupsName.h.cpp
1>  PCH.OceanPlugin.OceanPluginPrivatePCH.h.cpp
1>  PCH.OceanDemo.OceanDemo.h.cpp
1>  UELinkerFixups.cpp
1>  [5/17] Resource OceanDemo.rc
1>  BuoyantDestructible.cpp
1>  OceanPlugin.cpp
1>  OceanPlugin.generated.cpp
1>  OceanManager.cpp
1>  FishState.cpp
1>  FlockFish.cpp
1>  FishManager.cpp
1>  BuoyancyComponent.cpp
1>  BuoyancyMovementComponent.cpp
1>  [16/17] Link OceanPlugin-Static.lib
1>  OceanDemo.cpp
1>  [17/17] Link OceanDemo.exe
1>     Creating library D:\#UnrealEngine 4\Plugins\-TK-s-Dev\Binaries\Win64\OceanDemo.lib and object D:\#UnrealEngine 4\Plugins\-TK-s-Dev\Binaries\Win64\OceanDemo.exp
1>UELinkerFixups.cpp.obj : error LNK2019: unresolved external symbol "void __cdecl EmptyLinkFunctionForStaticInitializationOceanPlugin(void)" (?EmptyLinkFunctionForStaticInitializationOceanPlugin@@YAXXZ) referenced in function "void __cdecl UELinkerFixups(void)" (?UELinkerFixups@@YAXXZ)
1>D:\#UnrealEngine 4\Plugins\-TK-s-Dev\Binaries\Win64\OceanDemo.exe : fatal error LNK1120: 1 unresolved externals
1>  -------- End Detailed Actions Stats -----------------------------------------------------------
1>ERROR : UBT error : Failed to produce item: D:\#UnrealEngine 4\Plugins\-TK-s-Dev\Binaries\Win64\OceanDemo.exe
1>  Cumulative action seconds (6 processors): 0.00 building projects, 205.46 compiling, 0.00 creating app bundles, 0.00 generating debug info, 9.33 linking, 0.00 other
1>  UBT execution time: 100.95 seconds
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command ""C:\Program Files\Epic Games\4.7\Engine\Build\BatchFiles\Build.bat" OceanDemo Win64 Development "D:\#UnrealEngine 4\Plugins\-TK-s-Dev\OceanDemo.uproject" -rocket" exited with code -1.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Heres the .H BuoyancyComponent.h Header File - Pastebin.com and the .CPP BuoyancyComponent.cpp - Pastebin.com

I wouldnt call that a compass, its just a bearing indicator and only works with a possessed pawn. When I actually make a graphic compass that points to north (now that I figured out where north actually should be ingame) it would be worth including maybe. Anyone can build that blueprint in 5 minutes. I’ll share some of the C++ I outsource to a freelancer for our game like parts of a world map and streaming/infinite /etc as my contribution :wink:

You can fix by unchecking ā€œuse translucency vertexā€ in M_clouds MAT - At least it corrected my problem of clouds visible through water

Is there a way to make the waves all direct to the centre of the plane? I’m making an island map and currently have waves going backwards at the opposite side of the map, which isn’t very immersive. Loving what you guys have done already though :smiley:

Probably in the future but I cant think of an easy way to do that currently as you just set the ā€œwind directionā€ which affects the mesh displacement direction.

Thats unfortunate, but i’m happy to make do for now.

will be able to give you a more definitive answer because he actually wrote all(most?) of the manager. Timeframes? He is smart and doesnt say ā€œWe will have that done around may 15thā€.

Hey all I just thought of something. If you want a simple compass, add a text render component, enable it when you press C for compass or whatever and have it display the math above as the text. No HUD or UMG required. Im using that for debugging and thought I’d share that. Take a look at one of my mini updates I posted over at the SubSim for an example, you can see it right in the thumbnail.

watch?v=VOK3ZubX6a4

Thanks, good idea! From your video can I assume the OceanProject on has been updated with the new Cloud/Sky stuff?

No idea. Depends what branch. Ever branch has some different tweaks and of course you can make your own skydomes and atmosphere and stuff, depends on your skills, I have little so I’m just blabbering here. TK’s dev has a nice atmosphere IMO if you turn the cloud opacity up to 0.975 because the sun sets in the west like in real life.

Ahh thank you for mentioning , I will fix it up asap! :slight_smile:

That is really difficult to pull off, it would likely be better to adjust the rotation angle based on the players position. To have them render in a circular pattern is something that could be done though, I will look into it for a future release but will require major changes to the material setup. I will add it to the todo (or to-try :p) list!

Not yet no, still needs more work. Hopefully over the next couple days I will add in another experimental branch.


Tk’s new SSS, Buoyancy system, Buoyant Destructible’s, the basis for multiplayer and a few other new additions have been merged to the branch now (the plugin is the same as the one I gave you , won’t break anything :)), along with a demo level showing the new systems.

With that completed I am wondering if any of you will still be using the current BuoyancyMovementComponent (listed as BuoyancyMovement in the Components list) and do not want to switch to the new improved version. Please try out the new buoyancy system, it is much more accurate and highly configurable (named BuoyancyComponent, listed as Buoyancy in the Components list) in comparison to the original setup, afterwards if you still ant the original system to be available please let me know.

The new system is essentially the same base setup with a more accurate simulation of buoyant physics, and I would like to remove the old system if it’s not needed (to avoid confusion mainly, 2 different components doing the same thing).

Let me know which you prefer! Thanks :slight_smile:

We are currently using both until a struct can be used the same way as the current BuoyancyMovementComponent in BuoyancyComponent. To help people organize ships that they want to sink part by part instead of just a corner using 4 test points for example. The buoyancyMovementComponent() struct turned a 50 node blueprint into a 15 node blueprint when you added it.

Edit: From my team-member working with BuoyancyMovementComponent for submerisbles and flooding surface ships

Yeah I spent like a day on making the pre-struct(its still a struct set up I was just hitting a learning curve), while the post struct took me less then an hour to set up(after I understood structs more). Now I’m doing option 3, wish me luck LOL. However I would prefer a Buoyancy system that gives me more control for individual test points and that does not punish me for using more then 4. Handkors Buoyancy has that kind of effect and if I add one to try and balance a particular area it throws everything out of whack, no pun intended, its just the math is doing a force adjustment based on the total number of test points rather then calculating independently.