Unity VFX Graph - Materialize Objects Effect Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so today we are going to see how to materialize objects in unity [Music] i'm gabriel aguer currently working on rabbit's tail links below for more and i'm going to show you one way to measuralize any kind of object it could be for spawning an enemy drone or simply a weapon for example it's pretty cool and not that art we are going to use vfx graph and shadow graph so without further ado let's jump right into this and if you want to get access to this project it's all available on my patreon page where there's plenty of assets and projects for you so in my scene i have this base where the weapon or drone or any object is going to maturalize itself i made it in blender very quickly and basically there is two parts to this effect the first one is where the object materializes itself and the second part we see the final mesh the final object both are done via vfx graph so let's go ahead and create a visual effect graph with right click i'm going to rename it to vfx graph underscore object to materialize and the score tutorial and i'm going to drag and drop this to my scene and then press the edit button to open vfx graph and from here now basically we want only one mesh only one object at a time so up here instead of a constant spawn rate i'm going to use a single burst of one particle here we go only one particle let me just switch the bounce mode to manual and another thing that we already know is that we are definitely going to spawn an object so down here in the renderer in the output we want to drag a line and search for output particle urp lead mesh urp because i'm in universal render pipeline and lit because i want this to be influenced by light and if you don't see it you can go to edit any preference in visual effects you can turn on experimental operators blocks by the way we can delete this output particle quad and as you can see we have an input for a mesh it's spawning a capsule right now but we want to spawn our object so let's create a property a mesh property and call it to the mesh to materialize and connect it right here and then select the mesh we want i'm going to select the gun which is from the asset store by the way and there is one very important thing that you must do which is turn on read slash right in your mesh and then press apply and you are good to go so down here now i'm going to control the size of this because it's very small and it's useful to control the size of the materializing objects i'm also going to create a float mesh size for example in my case 1.7 it's a good value and as you can see the rotation is not correct so to fix this we can go up here in the initialize particle we can use a set angle and then create a vector tree and call it the mesh rotation connect it and in my case i already know that it's minus 19x and 90 in the z axis and it will face correctly and it will be properly rotated the only thing now wrong with this is that it has velocity we don't need we can delete this block and we can already say that the lifetime is going to be constant in my case 3 seconds it's the build up by the way the amount of time it takes to materialize the object 3 seconds but as you can see it is not very well centered this may happen as well in your case if it happens you can go down here in the output particle and use a set pivot block with this you can offset your mesh to the right position for example in my case minus 0.25 it will center the submachine gun with the base and if you want to write this up to animate these in the y-axis you can go to the update particle use a set position and we are simply going to change the y for example with a sample curve we are going to sample a curve which is going to go from 0 to 1 exactly like this or like this curve for example it will slow down towards the ends for the time it's very simple we are going to use the h over lifetime basically the lifetime of the mesh in this case 3 seconds and now the trick is to multiply this with a float and we are able to control how high it will get how high it will rise the object in this case compile this press play as you can see it's rising up and it slows down towards the end awesome and if you increase this value it will go higher you can create a float as well for this if you want for the mesh position y or mesh y position i'm going to leave it at 1 the default value or 1.25 all right so looking good one last thing we can do before using a shader to maturalize this is add a little bit of rotation and since it is something continuous we can use it in the update particle block as well and search for an add angle in this case i'm gonna add a very small value like 0.5 in the y axis and this will slowly rotate upwards so we have the motion we have the size it's looking awesome you can create a float for this if you want to but the most important part is the fact that we can use a shader for this and with the shader we can do a lot of things for example we can fake the sensation of materializing an object i'm going to show you a very simple shader but this can get wild i recommend you to check out my channel to learn more about shaders so right click and we can go ahead and create a blank shader graph or a lead shadow graph i'm going to call it the materialize shader double click to open it up and it needs a target in this case the target it's going to be universal in the graph inspector and down here i'm going to turn on support vfx graph if you don't see this that's because you are in an older version i'm using 2021 but in the active targets you can say it's visual effects great so we have this empty canvas our shader and we can do anything we want first let's create a color because we want to play with the color right and connect to the base color as simple as this i'm going to say it's hdr the mode so we can play with the intensity and with the default color of white and alpha to 100 and then we can for example create a noise a procedurally generated noise with a scale of 40 and connect it to the alpha and then if we create a float and call it clip and say that the mode is a slider from 0 to 1 and connect this to the alpha clip threshold we have made a very basic dissolve shader we only need to go to the graph settings and turn on alpha clipping and if we save this go back to our vfx graph and assign the shader we just created we are now able to let me play and pause this as you can see play with the clip to dissolve this away we are going to give it a materializing effect in a moment but for now this is a great step the way we animate this value once again is with a curve a sample curve we can say the curve for example it goes from zero to one but in this case we want to do the opposite and go from one to zero you can right click on this key down here if we connect the edge over lifetime which is basically the edge of the mesh which is three seconds and connect this to the clip if you play this it will start completely dissolved and then it will kind of start materializing itself let's just for example select an orange color and increase the intensity so it starts so it starts really bright like this okay and we are going to improve this a little bit more this is the basis but our next step is to spawn the final mesh and it's actually not that hard for example in this update particle we can say we want to trigger an event on die and the count is 1 by the way basically whenever this mesh is destroyed we want to spawn something in this case the final mesh so we are going to shoot a little bit by copying this wall particle system ctrl c and then ctrl v we are going to drag a line from the trigger event on die select gpu event and connect this to the initialize particle and now every time this smg gets destroyed it will spawn another one in this case the exact same one so let's fix that for example we don't need to set position we are going to inherit that's the great advantage of using a trigger event we can inherit values from the parents let's remove this we also don't need the trigger event on die these notes can go away and on here we want none for the shader we are going to create one in a moment we can also remove these nodes and now happier we also don't want this to have a rotation we want to inherit that value so it spawns exactly with the same rotation and to spawn with the exact same position we can inherit the source position we are narrate the source angle and the source position by narrating these two values whenever the first mesh dies the second one will have the exact same position and rotation which is wonderful because now we can make sure that this weapon looks ready to pick up down here well we not have a shader the default shader only adds smoothness metallic and a base color map if you have normal maps in your model or an emission map or an ambient occlusion map you cannot use it here so basically you need to create a pbr shader which had a graph fortunately i already have one created you can pause this video and copy it's a very basic pbr shader the first part is the albedo it's a texture we are sampling a text and multiplying with a color and connecting this to the base color then we have smoothness and metallic floats a range between zero and one and in my case this model came with a emission map so i have created a sample texture 2d to sample the emission map i have multiplied this with the emission color and then i'm adding a fresnel effect so it glows all around the mesh it's basically multiplying with a color so you can control the color of the fresno once you add these to the emission map you can connect this to the emission input and basically if you wanted to connect a normal map you could for example create a text 2d call it the normals right sample this and connect it to the normals input and that's it if you want to control the normal strength you could do it by searching normal strength and connecting the sample text or 2d to this node and you will have the strength input to control how much normals you want and so on as well for the ambient occlusion and other properties but once you have this basic setup with the albedo and with the emission you can go ahead and assign it here to the final mesh and as you can see we have pretty good looking smg obviously this needs to be worked to create a punchy feeling a more interesting result than simply replacing one with the other for example in my case i need to assign the emission map increase the emission color and as you can see those red parts are glowing you can adjust the smoothest metallic properties and for the fresnel if you want this to be bright at the beginning you can basically create a color property for the fresnel color right i'm going to quickly select an orange and increase the intensity but the trick is to multiply this with a sample curve as we have done previously if you sample a curve say it goes from 1 to 0 but push the last key to more or less 0.4 or 0.5 so it close only in the beginning and then connect the edge of a lifetime you can then multiply these with the fresnel color and you will have an intense glow in the beginning and it will fade away leaving only the final mesh awesome now it's all a matter of improving this for example down here you can add the set size of our life to create a punch scale imagine you have a curve a linear curve and then you add a key more or less around here and in the beginning it's big and then you can add a few more keys to create this bouncy curve you also need to set this to multiply instead of over right and what will happen is that you will have this punch scale in the beginning of the final mesh so this is the core of the effect there's a lot of things that we can improve i'm going to show you one more for example in our shader we can create a different type of materializing effects of dissolving effect by simply using a uv node and if we split this and use the g channel connected to a one minus so this gradient is inverted and if we multiply this with a simple noise and connect it to the alpha depending on the uvs we are going to get a materializing effect from the bottom to the top which did not happen now because i am using the uv0 channel but if i switch it to uv1 channel i have a different uv map where i have a different uv map the effect now will be from the bottom to the top as if it was materializing itself as you can see it goes from the bottom to the top only because i have switched the uv map these uvs since it is a model imported from the unity asset store i went to blender i imported the mesh the fbx mesh and if for example i opened the uv editor this is the uviz it comes with and the idea is to create a new uv map a new uv channel and on this uv channel we can for example press one in dumb path so we can have the front orthographic view and from here press u to unwrap the mesh based on the projection from view the uvs are extremely important for this and as you can see now by switching to uv shadow we get an effect from bottom to top and then i obviously added a few more things like a quick explosion a quick impact before the final mesh appears some rays as well that goes from the bottom to the top and a few more particles but at least now you have the car idea and you can materialize any object you want and if you want to get your hands on this project and see how i did these effects it's all available on my patreon page links below and you will get access to many other projects and assets that you can use talking about patreon i want to say thank you to each patron for supporting me and a quick shoutout goes to the top tier patrons which are 3d sorcery austin schneider aviator bali aya pranayama berkshire version claudia ruby dubidu jagmark duke williams duitron edward chai george jills walter giuseppe montfregla goblin plug guillermo trinidad kc miller kennen anselm maxim quentin journal radioactive bullfrog revenant games changi stephen t megal brown unknown sx val verizuta will use will poylen and ingu does a special thank you goes to each one of you and i hope you have enjoyed this video to everyone watch this i hope to see you in the next video thanks bye [Music] you
Info
Channel: Gabriel Aguiar Prod.
Views: 38,781
Rating: undefined out of 5
Keywords: Unity tutorial, vfx, vfx graph, vfx graph tutorial, unity, visual effect graph, unity visual effect graph, unity vfx graph, unity visual effect, tutorial, shader, shader graph, unity shader graph, unity shader, fx, graph, visual effect graph unity, unity tutorial, power up, unity power up, unity effect, unity vfx tutorial, unity visual effects, visual effect graph tutorial, shader graph tutorial, materialize objects, materializing effect, materialize, materialize effect, effect
Id: S6CDLfXQZ78
Channel Id: undefined
Length: 17min 23sec (1043 seconds)
Published: Tue Jul 26 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.