The Environment Community Project (The Ocean Project)

The Environment Project has officially released as of 06/12/2020!!!
This is the separation and improvement of the Ocean Project into various plugins!

PLEASE DO NOT ASK FOR HELP ON THIS THREAD. Go to the discord. Read the #FAQ first.
I’m trying to keep this thread clean, all common issues are in the #FAQ, and as new issues arise, they get added to the #FAQ

**Discord: **UE4 Environment Project (Ocean)

Welcome to the community created Environment Project! (Ocean Project)
The point of this project is create a nearly drop in, truly dynamic, environment that covers all the essentials for any game developer… It aims to provide a realistic ocean water simulation that is both highly customizable, and being as physically accurate as possible. The second aspect is in regards to the weather and time-of-day setup which are realistically setup to account for everything such as time/data/lat/long/timezone ect.

----------------------------------------------------------------------------------------------------------------------------------------------------------
Download:
Github: GitHub - UE4-OceanProject/OceanProject: Environment Plugin Project (Ocean Simulation, Sky Simulation, Buoyancy, Time, Fish plugins for Unreal Engine 4) (Now points to the Environment Project)

Original thread:
https://forums.unrealengine.com/comm…n-water-shader will provide an insight to the history of this project.

Credits at bottom of post.
----------------------------------------------------------------------------------------------------------------------------------------------------------



This is copy paste from original thread, some of it may be outdated, but still lots of useful information:

New Skydome Features

High accuracy sun & moon positioning, based on the input latitude, longitude, UTC offset, and local time. The calculations for this are very complex, and boring, so I’m only going to go over the values shown in the Debug HUD.

First, what you will see when you open the project, and how to set it all up for your desired location:

When you open the project, you will be in a demo level named dcSkyTestMap, which is a copy of the Island Map level with the skydome added. (if you don’t want to use the new skydome, the Island Map still has the old one). These 2 arrows will show you the direction of the Sun/Moon (yellow/gray) and will update themselves appropriately, and the compass is set to North == +X axis (has not been rotated, default world placement).

To change the date & time, select the BP_Sky reference in the World Outliner, and expand the small arrow beside Local Time in the Default section. Here you will also find the controls for Latitude, Longitude, UTC Offset Hours, whether to allow Daylight Savings time (calculated automatically if enabled), and a Time Scale Multiplier which allows you to speed up (or slow down) time. By default this is set to 10 which means 10 seconds of game time goes by every 1 second in real world time.

The values are automatically clamped in code to the maximum number of seconds in a minute (59), max hours in a day (23), max days in the current month (28 to 31), etc. I had clamped the sliders to not exceed these values, but for some reason it won’t allow you to change the value with it turned on, so just be aware that values greater than min/max do not have any effect.

Finally we have the Debug HUD, this will look very confusing to most people, but is as simple as I could make it while still providing the necessary information. Here’s what it looks like, the values are broken down below:

The best way to verify this data is to use this website and enter in the date/time, latitude & longitude info into these boxes (or use the map, but make sure the lat/long are correct):

With that entered, all of the other fields will populate themselves with data. The values in game vs the values on the website will vary slightly (0.1 to 2 degrees average) and are not meant to be exact, calculating the exact position is not feasible (or necessary) for a game / simulation. Using approximations allows high accuracy, without performance concerns.

Now, what these values mean:

SUN

  • Time Correction Factor (TCF): The number of minutes to add/subtract to account for the variation in Solar Time within a gives time zone.
  • Equation of Time](http://www.pveducation.org/pvcdrom/properties-of-sunlight/suns-position) (EOT): An equation that corrects for the eccentricity of the earth’s orbit and axial tilt for the given date/time.
  • Hour Angle (HRA): Converts Solar Time to the number of degrees the sun has moved. 0 == sun’s highest point, so the value will be negative in the east (morning) and positive in the west (evening)
  • Declination](Declination Angle | PVEducation): The earth’s axial tilt for the given date/time vs the sun. This varies from -23.4397 (northern hemisphere winter) to +23.4397 (northern hemisphere summer).
  • Altitude Angle](Elevation Angle | PVEducation): The vertical angle of the sun in the sky measured from the horizontal, 0 = sunrise, 90 = highest point of the sun that day (time varies) **NOTE: For this value to work in UE4 coordinates we need to subtract 180 from the result, this is why the value differs in the actual rotator’ pitch value.
  • Azimuth Angle](Azimuth Angle | PVEducation): The horizontal compass direction of the sun. At solar noon this angle will be exactly due south (-180) (local time varies)
  • Current Rotator Value: The current rotation of the Sun’s Directional Light.

References used for solar positioning:
http://www.pveducation.org/pvcdrom/p…/suns-position
http://www.stjarnhimlen.se/comp/tutorial.html#5
http://www.powerfromthesun.net/Book/…chapter03.html

MOON

  • Approximations L/M/F: These are approximations for the location of the moon in it’s orbit around the earth, including the inclination of the orbit, orbital eccentricity, arg of perigee, and longitude of ascending node
  • Ecliptic Longitude](Ecliptic coordinate system - Wikipedia): The longitude location of the moon on the celestial sphere.
  • Ecliptic Latitude](Ecliptic coordinate system - Wikipedia): The latitude location of the moon on the celestial sphere.
  • Mean Distance (km): The distance of the moon from earth, in kilometers.
  • Declination: Similar to the solar declination, this is the angle of the earth’s axial tilt, but also takes the inclination of the moon’s orbit into account.
  • Right Ascension: Angular position of the moon measured eastward along the celestial equator. Both right ascension and lunar declination are found by converting from ecliptic to rectangular coordinates (x/y/z), rotating to account for earth’s axial tilt, then converting back into spherical coordinates.
  • Sidereal Time: A time scale (measured in degrees) based on the rate of earth’s rotation relative to fixed stars, rather than the sun. This is a constant value that varies only by location (not time), which differs from the actual definition of Sidereal Time, we only use it as a reference.
  • Hour Angle (HRA): Similar to the sun HRA, however is measured against sidereal time instead of solar time. The number of degrees the moon has moved from time 0 (0 to 360 degrees).
  • Altitude Angle: Same as the sun, vertical height of the moon. Value is found by converting Ecliptic (celestial sphere) coordinates to geocentric (observer to sky) coordinates.
  • Azimuth Angle: Same as the sun, horizontal compass direction of the moon. Value is found by converting Ecliptic (celestial sphere) coordinates to geocentric (observer to sky) coordinates.
  • Current Rotator Value: The current rotation of the Moon’ Directional Light.

References used for lunar positioning:
http://aa.quae.nl/en/reken/hemelpositie.html

http://www.stjarnhimlen.se/comp/tutorial.html#7

There is an excellent video explaining the basics of how we calculate the time of day, calendar systems, and the earth’s rotation in the following video (which came out the day after I posted this). Highly recommend watching it to get a good idea how this works:

All of the above calculations are implemented in the plugin to ensure there are no performance issues. The blueprint BP_Sky is based off the TimeManager class (in the plugin) and uses it’s functions to calculate the sun/moon/moon phases in the base class. This makes the blueprint much easier to read, and reduces it’s complexity considerably. These functions could be used by any actor, such as a custom skydome system, by either adding the actor as a child, or inheriting from the actor and calling the Calculate xxx functions.

CREDITS:

DotCam :
-Project creator
-Ocean Manager
-Ocean Shader
-Ocean material

Handkor :
-Initial Shader
-Code for Buoyancy

TK-Master :
-BuoyancyComponent
-BuoyancyForceComponent
-BuoyantDestrutible
-Infinite Ocean System
-Screen Space Reflections (SSR)
-Planar Reflection support
-Distance Blended Normals
-Configurable Sets of Panning Normals (Small, Medium, Far)
-Heightmap-based Seafoam & Foam Wave Caps (Thanks Tin Le!)
-Cubmap-based Reflections (optional)
-Exposed many parameters to BP_Ocean. - You can now easily switch between shader versions, change textures, normals, foam, cubemap, heightmap etc.
-Underwater Distortion Effect
-Underwater Caustics

EvoPulseGaming :

  • Current project owner/manager
  • IWYU compliance fixes
  • Conversion into the Environment Plugin Project (Seperation of Ocean Project into individual plugins, cleanup, de-bloating)
  • Physically correct sun/moon position code.
  • Several fixes and improvements to the sky system (eclipses, clouds hiding sun/moon, sun/moon/clouds hiding stars)

:

  • Various tutorials

Nadrugal :
-Additions to the SkyDome

Burnrate (Justin Beales) :
-AdvancedBuoyancyComponent

QuantumV :
-BuoyantMesh

Komodoman :
-Fish flocking AI and a variety of fish:

Project maintainers (past and current):

  • DotCam
  • Zoc

​​​​​​​- EvoPulseGaming

  • TK-Master

BlueEagle :

  • Tons of code/project cleanup, conversion of ocean to cpp

Przemek2122 :

  • Tons of customization settings, conversion of ocean to cpp

Beskar_Mando :

  • New buoyancy system (In progress)

Snarf :

  • Fixed coding conventions on Fish System, fixed GetDayOfYear crash, moved underwaterbp to c++ for 2ms speed up (not imported yet)

This system uses techniques from many tutorials, however it would not have been possible without the help of the following users (Especially Handkor, he deserves a lot of credit for this!):
Handkor - https://forums.unrealengine.com/comm…hysical-ocean=
JBaldwin - https://forums.unrealengine.com/comm…review-Thread=
berna - https://forums.unrealengine.com/comm…le-quot-ocean=
ufna - https://forums.unrealengine.com/deve…hlight=vaocean
Ehamloptiran - https://forums.unrealengine.com/deve…urface-Plugin=
KhenaB - (dead link) https://forums.unrealengine.com/comm…ht=ocean+storm
gregdumb - https://forums.unrealengine.com/comm…light=gregdumb
and many others.

For those wanting more info on how the waves are created mathematically, THIS ARTICLE goes over everything. Specifically have a look at the section on “Gerstner Waves” for the actual equations that produce the waves.
(dead link) http://developer.download.nvidia.com…gems_ch01.html
(new link) https://developer.nvidia.com/gpugems…atural-effects

4 Likes

I am really looking forward to what comes out of this :smiley:

Thanks to everybody for their ongoing work to keep this project alive! :slight_smile:

Hello, I found this project only a short time ago.
I would be happy if anyone could use this project!
greetings and a wow to all involved!

great news <3

How might we implement some niagara effects to the wave crests ?

Would it not be pretty simple to use the heights of the waves, like trigger boxes or material dissolves, maybe triggering a niagara mesh curl noise effect to the displaced mesh as it enters ?

Ive got this project loaded in 4.22, cant build from source yet, but having fun playing with it, trying to comprehend it.

Great stuff here

How are you guys able to fake the translucency effect notably around the shores and near objects without the actual mesh itself being of translucent shading?

I downloaded the file but didn’t get the chance yet to dig deep. It will be great if someone can jump in to explain what is going on with the shading itself and if the water itself is indeed opaque to avoid self sorting issues found with translucent material.

Thanks

Hello. How to make the joints on the water together with the water. Or they just lie on the water without moving. Thanks for the advice))

Hi all,

I’ve been using the plugin for a while - it’s amazing! However I’ve come across a problem and I can’t for the life of me figure it out - it’s probably something simple.

The split screen/underwater effect only works in the editor mode. Once I’m in game it no longer does the underwater distortion. I was wondering if anyone knows what causes it? I’m baffled as I can’t think of anything that’s particularly different between the editor and game that should affect it!

Cheers.

Thanks for the set of mechanics, assets and work done. Please tell me how difficult it will be to adapt this system for an open-world multiplayer game? As an example, Sea of ​​Thieves. Is it difficult to make submarines with this system, where you can move a character (displace water effects and phisics from a submarine)?

Wow, okay, I didn’t know the redirect to this thread was active xD.

I don’t get on here very much, but I am always available on discord. See OP for link.

Most of the growing pains in learning to use this project have been addressed in the #FAQ channel of the discord.

And as far as the future of this project, I’m not a math genius nor a graphics wizard. So anything strictly rendering related will need help from someone who knows what they are doing. AKA, the ocean itself will have little change by me

I’ve not really gotten in to discord and it seems to be the key place to find fixes these days - I guess I’ll need to learn!

I’ve tried using the system on 4.24 and all the water materials are off in the world - but look fine when checked in the editor. I’ve done as suggested on discord but it appears the materials are upside down? I put the Z scale to -1 and now they’re the right way around (with the dark surface under the water and the reflective waves on top). Still can’t get the split screen distortion effect working though in game, only in the editor

Is your discord link still active? Not working for me unfortunately.

@ on dischord , add a server, select join a server and paste in [)

What should I download for 4.24?

Just the newest one and than do this from the discord FAQ:

Q: How do I get this to work in 4.24? The ocean is black?

A: Open BP_Ocean and select each of the components: OceanPlane, DepthPlaneUnderside and DepthPlaneTopSide, uncheck for each at the details panel: Render in Depth Pass. Immediately you will see the correct colors.

Just checked the invite link is working for me. Not sure what the issue is for you.

Also, interesting find. I’ll add it to the discord faq channel for now.

Thanks, downloading now the 4.22 Legacy Master… it’s the master branch download. Is there another version not legacy?

Which Github branch works for 4.24? Legacy_4.22?