Introducing Another Water Asset!

el_bearduno's picture

I noticed that there were only 1346 water assets on the Unity Asset Store. I thought, "You know what's better than 1346?"

1347!!

Maybe that would make for a good name. I was thinking about going the Ron Swanson inspired path and naming it Very Good Water, but I think Water #1347 has a nice ring to it. 

Why did I make another water asset when I could have used one that already exists? The answer is to learn. In my last blog I talked about Battle Meow, a game the team worked on for a game jam. Jams are the perfect time to hammer down and learn that thing you've been putting off. I've wanted to explore mesh manipulation for while and water was the perfect excuse. Here is what my water asset currently does:

  • Takes wave parameters like scale and spacing and warps any plane to a sin curve that uses those parameters
  • Allows Floater objects (sponges) to ask about their depth and calculate buoyancy
  • Allows any number of Floater objects to be placed on a rigid body allowing the dev to create simple or complex structures

Here is how it works in Battle Meow.

Battle Meow - Floater Structures

 

There are accurate and fast methods to calculate depth and float an object. This allows the user to customize their configuration to conserve processing usage.

Depth

  • Fast - Use the vertical position of the closest vertices on the water mesh
  • Accurate - Use bilinear interpolation of the 4 closest vertices to calculate the exact position on the mesh and use that height

Float it!

  • Fast - Lock position to the top of the water
  • Accurate - Calculate buoyancy based on amount of float submerged and add a vertical force to the rigid body at the floaters position

Here is a comparison of the results of each method.

Floater Algorithm Comparison

 

I thought we really had something cool and easy to use. Next, I was interested to see if we could apply this to real water. I picked up the Animated Water Texture Pack from the Unity Asset Store, alongside the free Brig Sloop Sailing Ship, and we were rolling in no time. 

Realistic Water Demo

 

I was on a roll and knew other common usages would be toon and low poly water. I added support for these modes as well.

Toon Water Demo

 

Low Poly Water Demo

 

There you have it folks, Water #1347. Is it perfect? Heck no! Did I have a fun time learning new skills? Yuuup.

If you made it this far, congratulations! I would give you a cookie if I could. ;)

Until next time!

Add new comment

Basic Editor

  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain Text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.