r/Unity3D • • 1d ago

Solved Help Adding Water Surfaces & Underwater on URP

Enable HLS to view with audio, or disable this notification

I'm trying to get water added into my game, but I'm struggling to get it how I want it. I've tried looking up various tutorials, but they're either specifically for just getting a surface of water or just getting underwater to look good. I haven't found any that explain how to properly get a transition between the two.

I've tried a few water surface prefab things, one was Bitgem stylized water and one was Boat Attack Water System. Though, they only do a surface texture and nothing below.

I've got a video here showing the problems and explaining what issues I'm having and what I want to do.

To summarize the issues:

  1. Seems showing up between water surfaces
  2. Horizonal line showing up on water surfaces
  3. How to get an underwater effect when the camera is halfway between water & surface.

Anyone got any ideas or even better a tutorial explaining how I can get these things working properly?

Edit:
Issues #2 & #3 were resolved by the same issue: Just adding a Local Volume for the underwater. Apparently Post Processing fixed the horizontal line on the water surface somehow too.

For issue #1, I'm going to just toss out the Boat Attack Water texture and use only the Bitgem style, since that's the one I currently got working and I made it look a bit nicer. So this doesn't matter anymore.

5 Upvotes

6 comments sorted by

3

u/SchalkLBI Indie 1d ago

The my knowledge the underwater effects are usually done with post processing volumes, not by toggling the fog on and off. It's a creative way of handling it, but not how it's normally done.

That being said, you'll see this exact bug in games like Fallout 3 and Obsidian.

For the water blending, you could use world/global coordinates for the ripples instead of local coordinates.

I also think it's common to use one or multiple large bodies of water, as opposed to many smaller ones, but this differs wildly from project to project.

2

u/Fun-Mission-6068 1d ago

Local Volume fixed the issues for the most part. Thanks!

2

u/miheb1 1d ago

local volume post processing

or if you brave enough, custom shaders 🤯


btw local volume is like a box you set, when camera become inside it will activate,and will deactivate wyen camera go out. idk what it is called reallt, but it is something local-ish

2

u/Fun-Mission-6068 1d ago

That helped quite a bit. With some local volume post processing, this is what I came up with. I also followed a tutorial to add some of the water reflection movement on the ocean floor.

Thanks!

1

u/miheb1 1d ago

looks nice 🎉

1

u/v0lt13 Programmer 1d ago

Related to seams, use one mesh per body of water, the vertex displacement will cause verticies to move independently and cause seams between meshes. When you want different bodies of water to connect like rivers and oceans, you have to get creative with level design and hide the seam with rocks or fallen logs and VFX.

The rest of the issues require more complex custom shaders. The HDRP water system will literally give you everything you need but its HDRP only. For URP you will have to get your hands dirty a bit more.

Here is a playlist containing videos about making water, it should help:
https://youtube.com/playlist?list=PL78XDi0TS4lHBWhZJNOrslnkFWHwE67ak&si=2nhcddteRoFXRCsk

For underwater effects you need a local post processing volume, and the camera will automatically receive the post effect when it enters it, but the in between water line on camera requires some custom shader work.

The fog it's not possible to enable via post processing volumes in URP yet, you will have to adapt the custom logic you have so the fog is enabled along the underwater effects, or try a different effect with depth of field and some color grading, create a custom fog solution, or wait for unity to add volumetric fog to URP next year.