Unity VFX - Ground Cracks | Fissure | Hole Effect Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so guys today we got a very nice trick in unity that's super useful and as you have guessed by now it's ground cracks and with this technique you can basically open up holes in pretty much any 3d object without touching the existing mesh which is awesome it has some limitations but nonetheless it's super cool i used this technique and made several ground cracks and features with different shapes and feelings and colors and i made them malavell on my patreon page links in description and quick shout out to today's sponsor which is rpg builder which is all about building an rpg game without coding that it is highly customizable and it comes with so many features already implemented plus the developer is super active on this card and he can give you a hand or you can watch the continuously updated youtube channel where he keeps on posting new features that are always coming out and it's currently on sale or it will be soon there's a link in description so with that being said now let's see how we can crack the ground so quick overview this effect is going to be divided into four main parts the first one is an image created in photoshop you can use or crit as well the second step we are going to use blender to create the mesh the 3d object the third step is in unity and we are going to create a shader that disables the right combining with a custom configuration of the stencil buffer and lastly we will create a glow shader to add this cool aesthetic to the crack on the ground so i'm going to use photoshop and i'm going to create a file with 2048 by 2048 and with the bucket tool i'm going to paint the background to black then we can create the layer and it's a very simple texture where we only need the pen tool this tool right here p for shortcuts and this is the step where we start designing our crack or our feature that we want on the ground and it's a very simple tool to use you only need to point and click until you create a similar shape to this one or to one you have in mind once you have closed the shape you can also move points while holding control if you are in photoshop but what really matters that with right click you select fill path and in the content we can use color and choose black and that's it now you simply need to add the black background and export this image as a png now let's open up google and search for png to svg and i'm going to leave a link in description but one i like to use is convert you in this site you can upload the file in this case our crack make sure it's black otherwise it won't work and then you can click on convert once you download it to a folder you can open up blender i'm going to press a to select everything and delete and then in file we can move to import and select scalable vector graphics and then you can navigate towards the file you just converted and import it as you can see it's super small we are going to increase it in a moment but first we tab let's enter in edit mode select everything with a and then with shift s we want to choose cursor to select it now with ctrl shift alt c let's select origin to 3d cursor we are basically resetting the pivot of this object and now if you open this right side panel in transform you can insert zero zero in location and also five five in the dimension x and y only and with that being done if you enter into this mode you will notice this is a bezier curve so in object mode we want to press alt c and choose mesh from curve and now we tab if we enter indeed mode you will notice that we have a lot of geometry that's another problem so select everything press space bar and search for decimate it will simplify a lot the geometry and remove all of these faces you can open this decimate geometry panel and in my case if i set the ratio to around 0.05 that's the limit before it starts removing too much geometry now still in edit mode if you want you can press ctrl tab and select faces and for example when you have two triangles like these ones you can convert them to a face and you will basically make this mesh lighter right basically you can select two triangles and then press f to create a face and that's it with that being done let's name this object in this case this one is going to be ground crack top now still in edit mode and with everything selected we want to press e one time and then go downwards in the opposite direction in my case more or less minus 1.5 meters now with control tab i'm going to select faces and press 1 so we can see these sideways and press z to see true and select only the top faces because now with p we can separate the selection and if we go to object mode we tab as you can see we have this top crack separated in fact let's correct the name remove the zero zero one and name the other object to ground crack walls they are going to be the walls of the crack the part that goes underground okay so that's it for blender for now we have two meshes and we can save this blend file directly to your unity project and if we move over to our unity project in my case i'm using 2020.1.13 with the universal render pipeline and in here make sure that you go to package manager and you have shadow graph as well as visual effect graph install it once that is done if you have saved your blend file directly to udt now you can simply drag and drop it to your scene and here we go we have our crack in unity and by the way if you select the top mesh and you don't see it you only see it if you go below it that means that you need to go to blender again select this top mesh enter in edit mode select everything with a and press space bar to choose flip normals once you have done it you can save this blend file and since it is inside unity it will automatically update and you should see the change now this step is probably one of the hardest ones and most complicated and as it is now we cannot do this step in shadow graph because we can't control the stencil buffer so we have to do these following steps as you can see i have this ground which is simply a cube and it's set to a see-through layer you can press add layer and make sure you add a layer mask and a see-through layer we need these two layers i recommend you copy these names and then that you set your ground to the see-through layer once you have done it you can select the crack top and change its layer to layer mask and it seems like it has done something because my render is already set up it seems like it has done something because if we go to idit and press project settings if you go to graphics and click in this scriptable render pipeline udt will highlight it in your project you can select it and then up here click on the forward render so you can locate it and now we need to make changes to the forward renderer as you can see i already have the mask and the see true render object setup and i'm going to remove them and show you how to set them up so first make sure that up here everything is the same especially in the pack layer mask you want to unselect the two layers you have created layer mask and the see through layer this tells unity to not render these two layers at all down here you want to turn on stencil the value is going to be 0 and the compare function is always now we are going to add back those two layers but render them before rendering or pack objects let's add a render feature the first feature we want to add is called mask and it's an event now it's going to happen before rendering or packs if you want to learn more about renderers i highly recommend you to check out the links i have in description by the way and then this render object it's going to be only for the layer mask and as you can see it has automatically changed the crack top it's now visible and we still need to create an override for the stencil buffer for now let's turn on stencil over right set the value to 1 and the pass is going to replace what's important is that you see the render object created in this case mask below the forward renderer and make sure you press ctrl s to save now let's add another render feature this time it's going to be called see true and it's an event that it's also going to happen before rendering opex but only to the objects that are in the see true layer and now it will render once again the ground we also need to override the stencil buffer with a value of 1 and in this case it's not always going to compare it's only going to compare if it's not equal and now make sure you press ctrl s to save again and if you unselect forward render and then select it again you may have this bug where the configurations disappear and that's annoying the way we can solve it is by directly selecting the mask here and then once again override the stencil buffer with a value of one always compare and the pass is replace and for the see true render object we are also going to override stencil with a value of one it's not always going to compare it's only going to compare if it's not equal and here we go so with right click we are going to create a shader but this time not the graph we are going to create a standard surface shader and we can rename it in this case to disable z right double click it to open and once you have opened you can select everything with ctrl a and delete it and then we are going to type shader open brackets this is the name you can put something like custom slash disable z right in the sub shader we want to declare a tag now it's going to set the render type of this shader to be opaque and in the past we are going to simply say z write off we are disabling the z right so it can render what's behind as you can see the crack it's not rendering what's behind because it's so back we cannot see true and because z right is on but in this new shader we have disabled it so we should see true so let's create the material out of this shader and simply assign it to the crack top and once you do it since it's disabling the z-right it looks transparent but in reality it's still there and it's still casting shadows by the way but here we go we have a crack on the ground we have a hole in the ground and it's certainly looking awesome now we are going to create the shadow graph to add some glow to this crack and make it look much better so with right click you can go to shader and this time create a pbr graph and let's already create a material out of this shader with right click and assign it to the crack walls and it's pvr because if you want to add textures and if you want this to be influenced by light and control the metallic and smoothness properties you still can do it with this basic setup in our case i'm only going to create the glow anyway for the glow we want the color glow color in hdr and i'm going to choose an orange increase the alpha and the intensity as well we can drag and drop it to around here and we are going to create the gradient so we are going to use uv and if we split this we get access to a gradient in this case we want the green channel the g channel and if you connect it to a power node as you can see it goes from black to white and now we can multiply this power node with the color and we can connect it to the emission input if we save it it should happen something right if you have used blender to create your mesh you need to go back to blender now because it doesn't have any uvs so what we are going to do is we are going to drag a window from this left bottom corner just like this and up here we are going to select uv editor now if you enter in edit mode of the walls and press a to select everything as you can see we don't have uv maps to create them we want to select only the bottom faces because we want to separate them once again with b because we don't want this to be affected by the gradient then we are going to rename this to ground crack button select the ground crack button enter an edit mode you need to be in top view you can press 7 in your numpad select everything with a and press u so we can create the uvs and we can create it from project from view and it will create the uv maps for the crack button now for the walls we also want to enter in edit mode select everything with a press u and select follow active quests and now we can scale this down until it fits in this uv square once you have adjusted the uvs to be like these as you can see if we select this top vertice they represent the bottom of the mesh which means we need to rotate 180 degrees the uvs select everything with a and rotate with r 180 and now they correspond to each other the bottom of the uvs is the bottom of the mesh and that's it for the mesh you can press ctrl s to save it and it will automatically update in unity and you will probably see this intense glow anyway as you will notice this glow should be the opposite we want the glow to be brighter at the bottom so in our shader after the split we want to invert this with a one minus node and then connect it to the power node rearrange this and save it and as you can see chana we get a nice looking glow that goes from the bottom to the top and that's when this becomes visually very interesting let's just create another vector one so we can control the power we are going to call it glow power with a default value of 2 and connect it right here to the power node but we still need glow for the crack button that's very simple we only need to duplicate the glow material i'm going to rename it to glow bottom or bot and the other one to glow walls so we can distinguish them and we can assign the glow button to to the ground crack button and as you can see we have a little gradient down here and the easiest way to solve it is to set the glow power to zero and you can increase the intensity or even change the color but yeah this is the main idea if you want to know how to add particles i recommend you watch other tutorials about vfx graph there's other tutorials on my channel that you can check out anyway the possibilities are a lot of course but at least you got the basics done and you can explore from here and if you enjoyed this tutorial please smash the subscribe button and leave a like if you want to support me you can also get these assets and much more effects for your games and projects to all my patrons these videos will not be possible without you and a special shout out goes to the top tire patrons which are adrian breton alejandro hernandez ckvfx darius prenskus david crew goblin plug guidely immariah's pc hostile mars game john nicks josh mccormick jules klein oytsk and vincent maverick really appreciate the support guys means a lot and thanks everyone for watching i hope to see you in the next video you
Info
Channel: Gabriel Aguiar Prod.
Views: 36,938
Rating: undefined out of 5
Keywords: unity, unity vfx, unity vfx graph, unity tutorial, tutorial, unity effects, unity special effects, unity magic effects, unity particle system, unity particle effects, unity particle tutorial, vfx graph, vfx, unity vfx graph tutorial, vfx graph tutorial, unity ground cracks, unity hole, unity ground hole, unity fissure, fissure, ground cracks, ground hole, hole, unity ground crack, unity cracks, unity stencil buffer, ground, crack, unity hole shader, hole shader, hole effect
Id: qiAiVa0HtyE
Channel Id: undefined
Length: 16min 38sec (998 seconds)
Published: Tue Dec 15 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.