This is my new upcoming game Twisted Waters
and it has the most realistic waterbending you’ve ever seen. Realistic water is one of the hardest things
to render in Computer Graphics. Its liquid shape and transparent appearance
make it challenging to capture. We have seen it done in live-action movies. But even with the best hardware, it can take
hours to render. So, how is it possible to render realistic
water in video games in real-time? I have had the same question so 6 months ago
I started researching this matter in an attempt to make the best possible waterbending game
with responsive and physically correct water. Hey, hey, it’s Tamara here. I grew up watching series like “Avatar the
Last Airbender” and “H2O: Just Add Water” and there is one thing they have in common
- the ability to control water. I have spent an embarrassing number of hours
pretending that I could control water. I don’t do that anymore. Mostly. But hey, I’m a game developer now. I can make a game and pretend I can waterbend
there. As with any indie game, it has to have lots
of features, a great story, and a huge open world, and in this case, super realistic water. So let’s get to work. But why is the water in games hard to make? And I’m talking about realistic water, not
a blue substance that symbolizes “water”. Transparency, refraction, caustics, reflection all of these things are complicated which
makes the water kind of a nightmare to render. But despite all of these things, we have seen
incredible water in games. So what is the problem? The water you usually see in video games is
a mesh surface with a bit of wiggling for waves and a shader for the color. It can look incredible like in Sea of Thieves
or terrible like my first water shader but it is still a plane. The technique behind the water is specifically
tailored for a horizontal plane. But the way the water looks mid-air is very
different. It can take any shape, it splashes, it pours. There is, however, another way to render water… Fluid simulations I became obsessed with water simulations. I watched them over and over again. I wanted that kind of water in my game. So I got a sample project off of the internet
and… It barely ran on my computer. And it was the optimized version. I was losing hope. And then I saw this… Unreal Engine already had a fluid simulation
wrapped in a pretty box, just staring at me, calling me to try the 60fps. But I was a Unity girl, I didn’t know anything
about Unreal. And then the Unity pricing disaster happened so I finally gave in and decided to try Unreal
Engine. Things didn’t go well from the start. So this might as well be the end of my Unreal
journey. My graphics card is super bad. Like I knew that it was bad I just didn't
realize how bad it was. I was really sad for a bit, but then picked
myself up, put everything on the lowest settings, and got to work. So I worked in Unreal for just a few days,
three, to be exact, and I already have kind of like a working prototype of what I am trying
to do. And I really can't believe how fast I was
able to get it up and running. The progress was slow because there was not
much documentation on water Niagara Fluids But thanks to Asher Zhu who works in Epic
games and blogs about Niagara Fluids I managed to make it work. There was just a small problem though. A quick lesson on water simulations. They mostly run on the principle that many
particles make up the water body. Each particle influences others based on their
proximity, but checking that for ALL particles is a lot of work. So researchers decided to manage particles
in a grid and check those in the same cell. They also put these calculations on GPU to
run them in parallel to cut down the time even more. But. The simulation domain is still limited by
the size of the grid. It could be significantly larger on a powerful
graphics card, but on mine, it just wasn’t. I had to add some smoke & mirrors. What if I could have one water domain that
would move along with the player and another one that would be the source of the water? And then I would just sync them on the intersection. And it worked! But the more I stared at it, the more I realized
that I didn’t like it. The shape of the water was boring, it had
an unnatural color that got darker when the water was lifted, and it had a weird reflection
on the bottom. I couldn’t believe that I had spent so much
time figuring out Unreal to just end up here. And that was it for me. I was done with the water simulation. But, I still want to make the game. I just had to add more smoke and more mirrors. So let’s start from the beginning. I decided to make the water look amazing but
on a static sphere mesh. If I can’t have the simulation, at least
the water would look great. Aaaand, it looked like sh*t. So I had to try harder. I had to become an expert in shading. I even got a cat because every respectable
game developer has a cat. I am not exactly a master of materials now
but the cat is cute. And she does help me. The sphere was starting to look like a water
ball. There was just something missing. The movement. When creating the look of water, I used glass as a reference. But water is the element of change, it has
to flow and respond to every move the player makes. And I wanted it to interact with the world
when it was dropped I didn’t want a pre-made animation like
you see in other games. I found out that I could use vertex displacement
for movement, much like it is used for waves on a water surface. And the water became alive. There was just something off about it. You know, apart from floating with no gravity… No gravity? Water in space IS basically waterbending! So I found these clips from NASA with water
in zero gravity. And turns out I needed to add some jiggly
physics. One down, more to go. Now, how do I make the water splash when it
hits the ground? The only way to achieve that is with particle
collisions but that’s almost the same as water simulation. So I thought why not go back to it but this
time use it very cautiously. I also realized that I was previously simulating
around 200k particles so, of course, it crashed my computer. But up to 10k particles were totally fine. And it’s all I really needed. I didn’t even have to put my project on
the lowest settings. At last, the water was ready for the world
to see. So that’s… NOT it. How can we have waterbending without Katara’s
signature water whip? So back to the brainstorming. Fun fact, in the Greek dubbing of Avatar,
Katara’s name is actually Tamara, because Katara means “a curse” in Greek. A whip is basically a water trail. Trails are fairly common in games but the way they are usually done is not fitting
for my realistic water. The answer to this problem lies in fluid simulation. The simulation itself is just calculations
of points with nothing on the screen. It can be visualized with spheres but it doesn’t
produce that seamless look of liquid. So what is it then? Metaballs. These are seamless blobby objects created
with some math magic. The thing is, they can be used without the
simulation. And they’re much cheaper for performance. So I can have my water ball made completely
out of particles. After some strenuous thinking about the whip
shape, the water was finally ready to show. And this is how it looks in the game. It performs pretty well, even for my computer. There is still a lot of work to do but that’s
where you can help me. First of all, Twisted Waters has a Steam page
where you can already wishlist it. Secondly, from now on I will be posting my
development progress on social media so you can tell me right away what looks best in
the game. Make sure you follow me. All the links will be
in the description. That’s it
for this video. Thank you for watching. See you next time! I was trying to cosplay Azula but I think
my bangs look more like Ty Lee’s