Unity Liquid Simulation Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome to another unity3d tutorial in this video we will be looking at how to create this fluid liquid effect by using materials and shaders do not worry this video is easy to follow along too so let's get started I've gone ahead and created two sprites for this effect the first is a circle and the other is simply a square begin by adding two sprites to your scene one for the liquid particle and the other for a basic collision container add a new layer called effect layer and place it on our liquid particle we just created to achieve this effect we will need two cameras one will render the circles we need to blur for our liquid and the other camera for everything else create a new camera and call it effect camera change its projection to orthographic and its position to 0-0 negative 10 change the culling mask to only see the effect layer and remove the effect layer from our main cameras culling mask now we have two cameras main camera that doesn't see sprites at all and effect camera that sees only the blue particles now we need to blur a liquid particles luckily for us unity has a built-in script and shader but I've made some small modifications so please pull from github and import into your project [Music] add the new blur controller to the effect camera and assign the newly imported shader as well I've also cleaned up my scene by setting the camera's flags to solid color and set them to white you should now see blurry circles effect achieved now we need to cut out pixels with low alpha from the effect camera to reduce blurriness go to assets folder and create a render texture let's call it texture from camera now set the texture size to 2048 by 2048 drag it to the target texture field on the effect camera to display the particles we need to apply them to a quad and a quad to the scene and scale its ratio to 1 to 1 with the render texture size or simply 20 by 20 if you're following along create a new material for this squad and use the unlit modification shader which can also be found on github the new changes add a few properties to the shader such as color cutoff and stroke apply the render texture to this material and feel free to customize the color options I've gone with blue to simulate water we now need to set the material on the quad to the one we have just created by moving the liquid particles closer together you will now see that they begin to merge together to create the water effect we simply need to add some physics to these particles I will start by creating a container with box colliders I will now add a 2d rigidbody to our water particle and give it a circle Collider set its angular drag to zero [Music] to create smooth movement it's also a good idea to create a physics material and set its friction to zero apply this physics material to the rigid body and the collider to finish up we need to increase the blur value on our effect camera use values 7 for iterations and 0.7 for the spread this only works if you've been following along and keeping everything the same as I have that's it for today's tutorial you have now created a quick and easy liquid effect inside unity as always project files are on github thanks for watching and consider subscribing [Music]
Info
Channel: Vue Code
Views: 83,830
Rating: undefined out of 5
Keywords: unity, unity3d, unity tutorial, unity shaders, shader tutorial, unity liquid simulation, unity simulation, unity liquid, free download, liquid effect tutorial, tutorial, brackeys, c#
Id: 3r6o8CfRlA4
Channel Id: undefined
Length: 4min 39sec (279 seconds)
Published: Tue Jul 31 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.