Hey Dotcam, can’t you just reconstruct pixel position from scene depth map in pixel shader and then just use it as a mask for your underwater PP shader?
Unity has a water soluton but I beleive its just a shader applied to a plane I never played with it. Import the environment asset package when you make a new project. There is ‘Water (basic)’ and then drag the day or night version from the prefabs folder into your scene. Its a plane with a shader and animated water texture with a basic script (didnt open the script). Tehn theres regular water under ‘Water’ same deal just alot nice working and lastly ‘Water 4’ which is the water system they made for unity 4.x Its an actual mesh I used ‘water4 advanced’ prefab. They use gerstner displacement for the mesh too. They have a bunch of scripts, but it looks like they are wrapped to private DLLs somehow, probably because the water system was pro only before.
Their tiling system works great, blends together perfectly. Gonna have to learn how to tile at least 16 of your ocean planes together to make one “tile” in the world and thousands of those for the coast and then at least 26 tiles blended together to make a large ocean that can move with the player for an infinite ocean.
And of course theres the open source water project for unity. I can get you all the versions of that, the underwater version the regular version theres 4-5 good ones. Its all C# though and I beleive they all use FFTs. Franks Triton Ocean who knows… because as far as I know you cant just peek into the source of c++ compiled into .dlls like you can regular c# in unity using .net Reflector.
Hey Dot heres an issue I was wondering about. If we scale our model down a TON (like 3 feet long instead of 300) so that it scales fine with the stock wave settings. It seems all the foam gets unproportionally large. Any easy way to adjust this or would I have to just resize the foam texture/material?
DotCam, stating the obvious, but GREAT work! Any idea on the first official release and underwater FX?
The foam is scale able, I was playing with it last night. should be foam settings in the ocean object properties.
Found a little thing:
It works fine only in the foliage-mode, but not when Im in the other modes and try to edit it.
What can be wrong here?
That’s a good point, it should be possible. Would that allow a line dividing the water from the air? for example as you go underwater the water surface goes from the bottom to the top as you go down, or would it still instantly turn it off/on? Hmmm… will need to test that out it should work, thanks for the suggestion!
Thanks for the info, will look into that soon!
LOD is the next thing to be added in, if you are interested I am looking to implement a procedural mesh generator similar to this:
Not sure whether to go for this now or get a basic LOD system working first, what do you think?
I’m in the process of setting up the GitHub repo at the moment, and need to make a couple quick tweaks, but very very soon (likely tomorrow).
What do you mean by “Foliage mode”? If the blueprint is in the scene all you should need to do is select it in the outliner and edit it in the details panel. Sorry not sure what you mean, can you clarify that bit? thanks
In the modes panel in the editor, when Im in the foliage-tool everything goes smooth. But when Im in the other tools (lights, BSP ect) it starts to lagg. This is when I have a fresh OceanDemo scene only and as well as in my Erebor project.
I have no idea why that might be happening to be honest. I just tested it on my machine and did not see any differences between the two, although I have a pretty fast system with a GTX 980 so it likely doesn’t show up for me. The Ocean material is pretty complex, over 600 instructions so it is not surprising to hear performance issues. I will be working on adding in the various feature levels in the near future.
So even with no foliage going into that mode increases your FPS? or is this the ocean itself is slowly rendering but the editor is still responsive? or is it the other way around, ocean renders fine but editor is slow?
I am putting together a base hardware system at the moment, with a GTX 660 ti and a slightly older i5 as a test machine and to use as a build server. I will be able to test it out then, but this only happens in projects containing the ocean correct?
On 4.6 everything went well Yes, its lagging even with no props or anything in the scene. But I can live with that bug, as it isnt too annoying, when its working fine when Im in the foliage-tool.
Yeah, I understand that this system is pretty complex. Like I said, its the most realistics watersystem I have tried. I could dive right into it (If I knew how to swim)
Np, btw, I’ve just checked how it is implemented in Battlefield 4 and FarCry 4 and they actually do it the simple way - camera’s always above or below water completely. And for example in Battlefield 4 on Naval Strike map with some big and choppy waves it is possible to see “underwater” geometry without any PP applied while swimming through a huge wave.
I got an idea, if its not possible already. What about waterfalls?
We tried tiling multiple ocean tiles together. There is no apparent or otherwise just the odd pixel of a seam they seem to blend seamlessly!
Procedural as in the ocean floor? I think people who need it (very few only people like us using submersibles) would need that and could do it themselves. At the same time LODs… on my gtx 760 even with 16 ocean tiles I get 60-100 fps.
I downloaded it but how do I make any object to have Buoyancy because I tried to put a ship and it just sunk.
Add the buoyancy BP component IIRC I dont use it much yet, working on the GUI and adjust your test points and mass.
What is not OpenGL compatible? I’ve tried the other water from the learn section and it works fine on Ubuntu even though it uses tesselation etc. I only need to find out how to scale them up
for huge storm waves, any ideas?
Yep! Forgot to mention that, everything is using world space UV’s so you can tile/overlap without too much trouble.
I mean for the ocean surface plane, instead of using a static mesh use a generated one based on the camera position. You could then dynamically create lower LOD meshes fairly easily to get an infinite ocean surface. The sea floor would need to be done with landscape streaming.
Have a look at this article on how they work the LOD’s in AC 3/4 (doesn’t talk about the mesh, but a similar grid system would be used) - http://www.fxguide.com/featured/assassins-creed-iii-the-tech-behind-or-beneath-the-action/
I had another link with more info, I’ll see if I can find it again and post it up later on.
As Nsomnia mentioned, you will need to create a blueprint with the static mesh as one component, and add a “BuoyancyMovementComponent”. In the settings for the buoyancy movement you can create “Test Points” which actually determine how much force to apply. You need a minimum of 4 test points (one in each corner) but more can be added if needed. The interface for this will be improved soon, it is a bit difficult to get right at the moment.
The main reason is I am using Shared Samplers in the material. By default the material itself uses up 10 of the 16 samplers before adding anything, so that leaves me with 6 textures only. DX11 will allow you to use up to 128 Shared Samplers. It is possible to reduce it down, but some features would need to be cut from the material as it is now.
Aside from that OpenGL should work just fine, but as is currently it will not.
Wanted to ask Handkor about the Buoyancy. See I am changing the test points over a short amount of time and its not updating fast enough. Seems like the wave cycle has to run through first before it can take a new test point value. To picture my logic I am increasing the Z values of my test points over time to keep Buoyancy of the ship as it descends underwater. What happens however is that it lurches down after each wave cycle rather then a smooth graceful dive. If Handkor can get back with me on this to confirm that is how things will work, I can then try another dive method, or if he has a fix for it I would greatly use it.
What about if you want to use this in multiplayer?
I second this, and LOD too :P, I’ve played with Nvidia ocean demo, which make the LOD change whenever the camera move. It’s really great for an infinite ocean plane, tried implementing in unreal but I have no luck, maybe because my knowledge in unreal rendering pipeline is still limited
If you want to see their ocean implementation for references check it out here DX11 Samples | NVIDIA Developer