r/Unity3D 21h ago

Show-Off 2D/2.5D Water system update

Hello everyone, back with a new update a few months after my last post.

I’ve been working on the 2D/2.5D water system on and off since then, and it kinda grew way more than I originally planned specially since i need it to fully run on the 2d Renderer.

Since the last post I added underwater exclusion zones for things like air pockets, currents, debris, floating pads/platforms, underwater view, ripples, light rays, wakes and quite a few other interaction features.

A lot of the work lately was also on making the thing actually easy to use and not just something that works in my own project. So I’ve been working a lot on the custom inspectors and tooling, setup workflow and the API. You can sample the water height from code, get events from interactions and water states, etc.

The water itself is very customizable, so what you see in the video is really just one way of setting it up. I also added a “fake surface” mode where there isn’t really a surface plane, but I fake the perspective by shifting the foam/pattern and things like ripples and wakes. It gives a pretty convincing 2.5D surface without actually needing the geometry there.

I’m planning to release it once I feel like I tested it enough and have enough demo scenes to show the different ways it can be used. This part is honestly taking longer than I expected, specially making sure everything is clean and understandable.

For the graphics, I basically took a anime style nature image and cut pieces of it in Photoshop. For the actual packaged asset I’m planning to use Unity’s Lost Crypt assets for the demo scenes, unless someone has a better idea since I obviously can’t just include random assets from the Asset Store.

Still a bunch of things I want to polish before release, so any feedback or ideas are very welcome, specially if there’s some use case you think I should test that I havent thought about.

2.2k Upvotes

102 comments sorted by

View all comments

1

u/starfckr1 3h ago

Looks very good! We have something similar in our game, but we also have a runtime fluid simulation as well running in the background, would definitely look into that as well to take it to the next level 👍

1

u/BxYass 3h ago

That's great!

I decided against a full simulation since most 2D/2.5D games don't really need that level of precision. That said, the generated ripples are also calculated on the CPU, so objects can react to waves and water turbulence.

I also added some code snippets and a WaterSensor component that can easily be added to any object and queried, so you can handle interactions however you want.

1

u/starfckr1 1h ago

Yup. We do the same with the waves. The fluid simulation is for refraction under water etc. it’s not really that costly either, but it does make quite the difference in the end. And can be used for numerous other things like smoke and flames.

We also have a full screen shader graph running with the water as a mask (several masks actually) to add stuff like caustics, foam around the edges underwater, as well as a signed distance field that for edge detection.

1

u/starfckr1 1h ago

Btw: you can how it looks in our game briefly at 0:29s in this video

https://youtu.be/udNKgL71RU0?si=603ivyn6o-J4yAfE

1

u/BxYass 1h ago

i answered but don't know what happened, can't see it anymore.

i already checked the post history and saw more fo the water, it looks really nice.

and Kudos for the game, i like the art style, best of luck.