How Water Works (in Video Games)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hi i'm thomas and on my channel i love exploring the relationship between art and technology in video games and like most of us i was really inspired by cyberpunk's incredible cutting edge water physics and started to get really curious about how water works in other cutting-edge aaa games like sea of thieves and assassin's creed black flag so i decided to spend the past month researching and experimenting how water works in video games what i discovered is that there is a ton of smoke and mirrors going on behind the scenes in all of the water of your favorite games and i want to share what i've learned with you from my research and experiments and also talk about some of the cutting edge water tech currently in modern video games this is going to be a fun video this video is totally sponsor free thanks to everyone supporting me on patreon we had a few joiners this week so thank you very much no my money let's get one of the big main questions out of the way first why is water so hard to do right in video games in the first place why can't we just simulate water particles the answer is that simulating real time water is still really hard to do this is a big enough topic on its own but the short explanation is that pretty much all games have to prioritize making at least 30 to 60 frames a second for their performance combine this with different generation consoles and graphics cards becoming more expensive than some used cars compromises must be made for the sake of smooth gameplay so rather than accurately modeled liquid most games use creative cheats where textures vfx sprites normal maps and basic geometry are smashed together to give the illusion of flowing water let's take a look at some of those more interesting techniques for those of you who are new to game art you may have never heard of normal maps before normal maps are a type of bump map they are a special kind of texture that allows you to add surface detail such as bumps grooves and scratches that catch the light as if they are represented by real geometry but in reality it's just a flat plane if you look closely at most games you'll find normal maps are used all over the place even in modern games that are coming out now so what's so special about normal maps and why am i talking about them well if you know what you're doing normal maps can also be applied for a cool little trick when you're creating water if i use a simple node setup in unreal engine i can use multiple normal maps and pan the textures in opposite directions to get a basic water shader these normal maps do a great job at faking the micro details of waves and ripples you see on a large body of water without having to actually simulate anything it's just moving two simple textures over our plane and our monkey brains fill in the rest of the details for us pretty cool right by the way if you want to learn more about unreal engine you can check out my course where i teach you how to create full beautiful environments using unreal engine and you can also check my stylized texturing course as well i'll leave a link in the description this technique can be found all over the water in your favorite games from older games like half-life 2 to more modern games like uncharted 4 or far cry 5 and the cutting edge cyberpunk a lot of this magic is just simple textures scrolling over some simple geometry let's talk about another really important aspect of water it's caustics you know those shimmering patterns of light you see on the bottom of a pool or the strange light images created when light shines through a glass of water those are caustics due to the reflection and refraction occurring on water waves water acts like a giant warping magnifying glass that creates those light patterns that you see at the bottom of the pool now i get it this seems complicated but this technique can be done or faked pretty easily all you have to really do is just like the normal maps is pan and emissive texture on the bottom of where your water floor is then add a simple distortion and dissolve effect and you can simulate caustics pretty easily with a bit of tweaking for bonus brownie points you can add a distortion effect on the surface of the water to mimic refraction as well but thomas you say this doesn't sound very practical what games are going to use this well the same can be said about subnautica which takes place almost entirely underwater and is filled with really amazing caustic effects all over the ocean's floor this is an effect that seems like it's a small detail but if it wasn't there players would know something is missing so combining moving normal maps refraction caustics and some simple vfx like water particles and sea spray is more than enough to create a decent water shader from a simple plane and it does seem like tons of games do this there's also a lot of other stuff we could talk about like depth specularity god rays and reflectivity but you get the idea a lot of work goes into these now i know what you're thinking these techniques work really well for flat and calmer areas of water but what about modern games where water is more dynamic and reacts to other objects this is where i found things get a little more interesting so it turns out there's a lot of ways to make fake moving water but one of the best ways to do it and one of the most common ways is a method called vertex displacement vertex displacement makes it possible to control the positions of a mesh's vertices via a shader the cpu maintains the original positions of the mesh's vertices but it passes those values to the gpu to be presented to our eyeballs those vertex positions are then hijacked and displaced by the shader creating new geometry this technique of vertex displacement can be applied to the actual geometry of the water instead of having a flat plane with moving textures you can now have moving flowing geometry now this may sound complicated and it is it's a little mathy but this isn't exactly a brand new concept the game fear accomplished this at least a pretty good version of it all the way back in 2005 with some really impressive results this method of vertex displacement can be found in many old and new games often times where player models need to walk or interact with quite a bit of water some games even use vertex displacement when bullets and other projectiles impact the water combine this effect with a simple water splash sprite and you've got a decent looking bullet impact like in red dead redemption 2 but there are some modern games that take these techniques to the absolute next level one of the best examples of this that i can think of is sea of thieves on the open water you have these massive crashing waves that can be seen for miles these waves are most likely procedurally created every player sees the same thing the same waves the same currents everything which is impressive enough on its own the lighting in sea of thieves also has an extra level of care as well if the sun hits the water at just the right angle you can start to see these beautiful rays of light that shine and glow just under the water's surface and it looks especially beautiful as the sun starts to set according to my research this was intentionally stylized to add more color but they also made sure that it stayed rooted in reality now you take all of these things then you add some sea spray vfx and some more procedurally created foam that follows the waves and you've got a recipe for some incredible looking sea water there were plenty of other challenges the team most likely had to face like how does water render from a far away distance how does the surface look when you are underwater how do the shadows act when you layer it with refraction now i'll most likely be doing a video on the art and tech of sea of thieves to answer these questions i can only really scratch the surface in this video so i'd love to go into more detail later you can see a lot of these techniques and another great pirate game called assassin's creed black flag where the water has a lot of the same characteristics as the sea of thieves water in fact a lot of the assassin's creed games like valhalla odyssey and origins all have fantastic water tech but black flag is another game that stands out as a game that is taking extra care of their water art what really sells water isn't only the tech behind the water itself but how the water interacts with the world around it take ghosts of tsushima for example where spilling blood on the water in a little stream or river will cause it to diffuse and flow downstream it makes you wonder if multiple enemies are killed in the water will the river turn red with blood how far downstream will the blood flow will ever get around to doing an art breakdown of gosu tsushima we will never know and let's not forget the underwater plants in the witcher 3 swaying like their inner current there is no current but they've been animated in a way that makes it look like they are in one it's amazing tricks like this that give in-game water much more life you also have the amazing interactivity of water in rockstar games like grand theft auto 5 and red dead redemption 2 where the water reacts to essentially everything you can throw at it like raindrops jet skis players swimming and gunfire now since you've watched this video all the way through you now know about vertex displacement and have a basic idea of how this could work in game and then you have all of these amazing games built around the idea of water that i didn't really get the chance to talk about like breakwater hydrophobia super mario sunshine all taking different approaches to their water tech all this amazing incredible creative and innovative tech and cyberpunk doesn't do any of this so yeah water is pretty cool
Info
Channel: Stylized Station
Views: 566,041
Rating: undefined out of 5
Keywords: lets play, video games, crappy water levels, how to make water ue4, how t make water in video games, water physics comparison, bad water levels, water levels, video game physics, indie games
Id: BqJm3B8cubo
Channel Id: undefined
Length: 8min 55sec (535 seconds)
Published: Mon Feb 21 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.