Unity VFX Graph - Muzzle Flash Effect | Gabriel Aguiar Prod | Skillshare

Playback Speed


1.0x


  • 0.5x
  • 0.75x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 1.75x
  • 2x

Unity VFX Graph - Muzzle Flash Effect

teacher avatar Gabriel Aguiar Prod, Game Development

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

    • 1.

      Introduction

      0:45

    • 2.

      Muzzle Textures, 3D Meshes and Particles

      16:27

    • 3.

      More Particles and Variations

      7:37

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

2

Students

--

Projects

About This Class

This class is about the creation of a Muzzle Flash Effect with Unity VFX Graph.

What you'll learn:

  • Learn how to create a muzzle flash.
  • Learn VFX Graph for stylized effects.
  • Learn Visual Effects for Games.
  • Learn how to create textures with Material Maker.

Requirements:

  • Unity: Basic to Intermediate
  • Material Maker: Basic
  • Blender: Basic
  • Unity 6.5 or higher

Who this course is for:

  • Game Developers
  • Unity Beginners and Veterans
  • Unreal Beginners and Veterans
  • VFX Artists
  • 3D Generalists
  • Programmers
  • Illustrators
  • Animators
  • Digital Artists in General

Feel free to contact me here or on any social media below:

YouTube | Facebook | X | Instagram | Artstation | Discord

Meet Your Teacher

Teacher Profile Image

Gabriel Aguiar Prod

Game Development

Teacher

The Gabriel Aguiar Prod. Academy focus on creating high quality courses related to Game Development.

We are a small group of instructors eager to share their knowledge on topics related to Visual Effects, Character Creation, Programming and Game Development in general.

We are eager to share our knowledge here with straight to the point courses. 

Feel free to contact us if you have any doubts.

Discord

See full profile

Level: Intermediate

Class Ratings

Expectations Met?
    Exceeded!
  • 0%
  • Yes
  • 0%
  • Somewhat
  • 0%
  • Not really
  • 0%

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. Introduction: On these lessons, let's see how to create these pretty cool muzzle flashes. One looks like it's shooting straight from a rifle. The other ones look like it came straight from a Sci Fi game. Plus, we are going to see how to create some amazing muzzle flashes text. So you can have a proper Muzzle Flash in your game. Hi, I'm Gabriel Aguiar, founder of the Gabriel Aguiar Broad YouTube channel, where we teach Visual Effects for games in Unity in real and in Godo. And we also have one of the biggest libraries of Visual Effects assets ready to be used in games. I'm also the founder of Golden Bug Studios where we are developing rabbit still. So a lot further ado, let's get on with it. 2. Muzzle Textures, 3D Meshes and Particles: So let's begin by creating a Visual Effects Graph, which you can install in the package manager because you don't have it and begin with a minimal system. We can rename this to VFX Graph underscore Muzzle. And double click to open it up. And in here, we want to rename this to muzzle. It's going to be our muzzle. Say the bounds mode is manual with the size of 100 in X, Y, and Z. So even if the camera is not pointing at the effect, the effect still plays, or you can increase even more the bounds. First thing we need is to spoun something, and that happens up here where we can use a constant spound rate of one particle each second. And it's going to leave precisely zero dot 15 seconds. A very short amount of lifetime, it's going to happen really fast. On the output, we can remove it because we need to output an unlit mesh, a specific mesh that we are going to create for planes. But first, let's actually go back to our scene and create an empty that we can rename to VFX underscore muzzle, reset the transform. And I'm going to push it the value of two units on the Y axis, so it isn't intersecting with the ground. And then we can drag and drop our VFX Graph here and reset transform as well. And as of now, we are spawning a cube which is not quite what we need. So we need Blender to create something very, very simple. If you don't have it, go ahead, unload it, open it up, delete everything so you make sure you have a clean scene, and then with Shift A, you want to add a plane. We are going to enter the mode with tab, make sure you select everything, and with Shift D, you want to duplicate this and then press escape so it stays right there because we want to rotate it on the Y axis 90 degrees. You can press Y and then 90, and that's it. We have a biplane. All we need is to select these two vertices right here, and we shifts, make sure we say cursor to select it, and then we go back to object mode by pressing tab, and up here, we can set the origin to three dcursor. This way, it scales from this pivo right here, and that's extremely important. Otherwise, it will look weird your muzzle. Let's just make sure we move this to the center of our world here in Blender with first cursor to origin, we shifts, and then shifts again, but selection to cursor. This way the planes are centred with the world. One last thing we need to make sure is that UVs are correctly mapped. So let's open the UV editor on the left. And if you select the horizontal edge, as you can see, both are on the bottom part of the UVs, which means our texter needs to be vertical. If it looks like that, then you can move on. Rename this to Muzzle plane 01. Apply transforms with Control A, and then in file Export as an FBX, you can export directly to your project, make sure selected object is turned on and on transform, Z is up, and then you can also enable apply transforms and then press Export. Back in Unity, we can select our biplane here, our mesh plane, assign it to this output. And at this point, you have something that looks like this. Can control the size with a set size. For example, a value of two. My seem like only one plane is working, but that's because this share by default, it's only showing one side of the faces. Here we go. We have everything. We can fix that by selecting the output and on the inspector saying the call mode is off. This weight becomes double sided. Now we have VFX Graph. We have a mesh. We are just missing a texter. For that, we are going to use material maker. It's an open source node based tool to create texas and materials. Once you install it and you open it up, we can begin by searching for a box. This is going to be a very interesting texture. We want to create a rectangle by playing with the size, and then we want to invert this. This is going to work as a mask because we are going to pick up a shape a circle with zero feather, so it has this art edge. And with the tiler, circle is going to go to tile X and the inverted rectangle to the tile Y. And this is what happened at the center is empty because of the rectangle. But all around, we have these circles. Let's say we want these circles to repeat eight times on the X and nine times on the Y. And instead of being round circles, we want to squeeze them on the X to zero t two and on the Y to zero t four. Then we add a little bit of random offset, like zero t six and random scale like zero t four. Instead of having a random value, which is gray scale, we can say it's zero, and we will have this silhouette that we can invert again, and this is the beginning of a good muzzle. Because from here, we can use a transform and then a grade it on the scale X. That's how amazing material maker is because if you use a grade it on scale X, you can control how it warps. Basically, we want to have a very pointy end at the top, something like this. And essentially now we are going to repeat this form a couple of times. First, we want to use a transform to push it up. And then squeeze it. And if you use a tile two by two, we can connect the result transform to each input. And from there, use a circle splatter. And it'll splatter all of this information based on the circle shape. As for the count, we want only five. In terms of rings, we only want one ring to rule them out. Four inputs, let's squeeze on the X and stretch on the Y, and now we are getting to the most important part. Let's say the radius is zero, but the rotation increment is going to be zero dot 25. We can a a little bit of randomness in the random rotation here, three, bit of random scale two, zero dot 15. And now, basically, we need to rotate this back so it faces up, maybe center this a little bit on the X, push it down on the Y. And rotate it around -30 degrees. We don't want to clamp this. We want to extend this. Otherwise, we get that artifact. Here we go. It's pretty much centered, and now the idea is to use a math node to add this right here, and we get a muzzle. We get a silhouette of a muzzle. With this transform, you can push it down a little bit and then use a colorized node to make sure that white turns to gray. And then we can transform this again. But this time we can push it down and scale it down as well. And we are going to join these two, so we get something like this. And if we blur these out, we get a really awesome result 2048 by 2048 on the blur, Sigma of 25. And if you want to add even more texture to this, you can use a math node and multiply what we have with a wavelet noise. We can ski it up a little bit on the Y axis. And if we join these two together, we get this awesome result. And now with a colorized node, you can play with white values and with the black values or increase the brightness, and that's it. Or you can always open up Crete or Photoshop and draw yourself a Muzzle Flash by hand. Other than that, you can export this 2048 by 2048 as a PNG, you can call it Muzzle Flash, for example, and assign it in VFX Graph. Here we go. It's blinking, flash, not that much is happening. Let's switch the blend mode from Alpha to additive. But if you have a super bright background, use Alpha instead. With a set scale, we can control a little bit better how this looks, and we can make it random. For sometimes it will stretch more, sometimes it will be smaller. For example, between one dot five and two on the X and zero at six and zero at eight on the Y and on Z. We get something that it stretched and not too wide, at least for now. And in this case, we can randomize the angle on the X axis. Let's say it's random 0-360. Now, as for the color, let's go ahead and pick something a little bit more orange, almost red. And then increase the intensity to seven, six, eight around those values, and it will look beautiful, as you can see, with a set color of life. It goes back to white because the composition is set to over white. We want to make sure it's multiply. And we only want to use two keys up here for the Alpha. Exactly like this, this way it fades out, looking good. And now we only need to take care of the motion. We want this to grow up, but the composition needs to be multiplied. Otherwise, it's overwriting the previous set size we are using. We want something more like this curve, and then we can adjust this handle it looks good, as you can see. Nice. I would still randomize the lifetime between zero dot one and zero at 15. But let's add a few more elements for now. We want to add a cone to this. We can begin by copying and pasting this output, renaming it to cone. And yeah, we need a new mesh. It's a very simple one. For example, back to Blender, we can begin with a cylinder. On this left bottom panel, we can increase or decrease the vertice. In this case, 16 would be enough, and we want to make sure that the cap field type is nothing, so the top and bottom faces disappear. What we can do now is enter it mode, select this edge loop and scale it down to zero. And then we want to push it down a value of minus one. You can use this cursor right here and select the bottom edge loop and push it up a value of First, make sure that the UVs are correct. Yeah, we need to fix them. We want to go to top orthographic view. You can press seven on numpad and then select everything, press U, and then select project from view bounds so it fills out the UV space. Looking good. We can add a few edge loops with Control R, press escape so it stays right there, add another one and then scale it down to more or less around here. And then my clicking up there to see through, we can select all of these vertice and press delete, so it's allow on the center. Let's get out of the UV editing mode, and in the object mode, we want to rotate these 90 degrees on the X. Here we go. And we kind of need a cone shape. So we are going to go back in edit mode with tab, select the vertice at the center, and with this proportional editing on, we want to push it outwards. You can scroll up or down to control unmatched influences, but basically, we want to push a little bit the vertice outwards just like this. Little bit more here, as well as here. Here we go. Something more like a cone, exactly. We can shade smooth this and then let's enter mode, sect this edge loop here, and we shift S, we want to say cursor to select it and then go back to object mode, and up here on object, we want to say set origin to three D cursor. This way, the Pivot is right in the middle of our code. And in object mode, we shift S, we can say cursor to world origin, and we shift S again, selection to cursor. Here we go. Let's rename it to Muzzle Ce, apply transforms with Control A, and export as an FBX. Make sure we only have the cone selected and then export to Unity. Back in Unity, we can assign it here. Here we go. Beginning to see something, right, and we are going to need a proper text for this as well. But it's actually rather easy since we already have this muzzle flash created in material maker, we are going to reuse this with a transform. We wanted to push it up first and then scale it down. We can then once again use the circle splatter to spread this everywhere. We want four for the count and only one ring. And as for the radius, it can be zero, but incremental rotation, 15, and we will get this very beautiful sun shaped kind of stuff. We can add some random rotation, 25, random scale, it could be even higher maybe, but zero at one gives us a good value. Let's go back here because we are going to essentially adjust here parameter so we don't have that artifact on the translate Y. Here we go. The artifact is gone, and that's it. We can export this as a PNG 2048 by 2048. And back in Unity, we can assign it to our cone. Here we go. Looking good. Thanks to the UVs, we created, it maps properly to the cone and it's looking good. Let's make sure we add a flash to this, something really bright, really fast. We can copy this cone output and rename it to flash and we can actually use the quad that comes by default with Unity, assign the default particle, for example, and say the size is something like three yeah, let me pause this for a second. As you can see, it's quite bright for now. Maybe let's change a little bit color. And decrease the intensity. But what we really need is to push this a little bit forward on the X with the set position, 02, here we go. And most important of all, let's make sure that we use a orient block, so it's always oriented to the camera position. Here we go. Something like this. We can remove the set angle. Now that the main muzzle is done, let's work on adding a few details, for example, some particles. We can copy this entire system and then remove these outputs. Let's rename it to particles. And down here, we can drag a new output for a particle unlit quad. It's not constantly going to spa. We can use a periodic burst to visualize this. After all, we will change to single bursts. The constant spun rate and the periodic burst rate are useful to see the muzzle on a loop, basically. Let's say it's ten for the count, and they should leave between zero dot two and zero dot six. And now let's make sure they spa in a cone shape. Let's add here a set position, switch the shape to a cone, and we can spa only on the base, and then decrease the base radius to zero dot one. Let's also rotate this -90, so it's facing the same direction as the muzzle. And we can add velocity by using a set velocity from direction and speed. We can say the speed mode is random. For example, the minimum can be five and the maximum can be 15, and we can disable direction blend, so they go straightforward. Just add a delay up here in case you are using the periodic burst. If you are using the single burst, don't worry about the delay, and then we can make sure they slow down on the update particle with a linear drag, set to two. Here we go. The motion is looking good. Now let's take care of the aspect. Let's first increase their size to be between zero at five and one random. Because we are going to use a set scale to squeeze them on the X and stretch them on the y axis 02 and two, and then we can use an orient, so they align with their velocity vector. And we can animate their size with a set size of life, where we use a curve that goes from big to small. And we can use a color, set color. We can go ahead and copy from the co and paste it right here. Here we go. Looking good, looking bright, looking impactful, maybe too bright the sparks, but feel free to adjust them. And that's it. We have a very impactful muzzle flash. In our next lesson, we are going to add a few more particles, and then we will see how to create variations. 3. More Particles and Variations: Puts copy and paste with Control C and control via this entire system. Rename the first output to part cause one. The second not put two particles too, and these ones are going to be much smaller. For example, let's say it's 15 on the count, they leave a little bit longer. They are overlapping right now, but don't worry we will add a turbulence to these particles, and it will create a very different feeling. For now, let's go down here, decrease their size on the set size and make sure they are wider on the X of the set scale. As for set size over life, we can create a curve similar to this one. They start small, they grow, and then they shrink. As for the color, let's go ahead and copy the color from the flash. Both of these particles are really bright. Feel free to decrease them. Oh, and let's not forget that the set size should be set to multiply the composition. Let's do the same for particles one. Let's set it to multiply. Otherwise, it overwts the previous value. Here we go. So like I was saying, let's change the motion of these ones on the plate particles. We can replace these with the turbulence. If we increase the drag to five, that's enough to make them go crazy and set the velocity to two without any roughness, and it will create already a very interesting motion. For the intensity, we can control it with a curve. We use first the multiply node, for the A, we can use a curve. On the sample curve, we can use he over lifetime, which is basically the lifetime of the particle. And then as for the curve, we can say they don't have any intensity at the beginning, and then it peaks more or less around here and then it fades. For the B input of the multiply, we can use a random value, for example, so it's random 1-20, and we create this very crazy motion, as you can see. They are really bright and they are hiding the muzzle flash, so feel free to decrease their intensity. For now, we are going to decrease the size a little bit. Here we go. But all in all, it's a pretty good muzzle flash. So like I was saying, the constant spam rate can be replaced by a single burst and the periodic bursts, we can replace them with a single burst as well. On account, we can say ten for the particles one and 15 for the particles two. Now let's see how we can create a few variations from this. For example, we can first expose some parameters like the color of the planes of the muzzle flashes. Let's create a color property, call it color 01. We can use the exact same color with Alpha at 100 and then connect it to the set color. Then we can expose the texters. For example, let's create a text to the parameter called plain Textures. Let's use the exact same text that we are using here and connect to the main text. On the cone, we are using the same color. But we can create a cone texter. Let's use the same text we are using and connect it here. As for the flash, let's create another color because it's different. We can insert the same values of that color here and then connect to the set color. As for the particles. Particles one, use the color 01, and particle two, use the color 02. And just with these four parameters, we can create some very interesting variations. First, we can create a prefab out of this muzzle. Here we go. Make sure to always add Vfts on the score first, so it's easier to search the prefabs in your project. And then we can duplicate this one, rename it to Muzzle 02. And let's see about that new texter. So on Material Maker, we have all of these, and we can reuse most of it. For example, if we select these nodes right here, copy and paste them down here, we can delete this part and then use this result up here. We get this basically. At this stage right here, we can make a few changes like a different noise, a noise chart. And we can even make this muzzle wider since we are using this transform. We make sure the shard is really sharp. We make the scale bigger on the X, and we say it folds one time, but with only one iteration, we get this crazy noise texture. And if we add these two together, we get really interesting result. It's really too sharp, so let's blur it with the Gasanblur 1024 by tenth four on the grid size, and maybe decrease the sigma. But yeah, this is what we get very interesting result. You will see how awesome it looks on the muzzle. As for the colorize, we can clip a few black values here. Drag the white key to the right, and we can export this texter as the third one. And the cool thing is that we have this platter right here, which means for the cone, we already have our next text. Let's just export, and that's it. Now, back to Unity. For the Plains textre we can use the third flare and for the cone, we can use this new texter. And this is what we get. Let's actually make this blue for the first color. And for the second call, a lighter blue, but with lower intensity. Here we go. And we get a very different result. We can even create a third variation. Let's first create a prefab out of this muzzle and then duplicate it. It's going to be a third muzzle, and we can go back to material maker to create new texts. We just need to copy this part right here. Connect from the math exactly like this, so we can get to this part, and then we can use a different noise. Let's remove it. And we can use anisotropic noise with these horizontal lines. They don't need to be that much on the Y axis, let's decrease it to 50 without any smoothness. And then let's connect this to a rotate node, just so we can rotate this 90 degrees. Here we go. Before connecting to the math node. This is what we get. Let's remove the Gasienblur because we can use this as it is. With this colorized node, let's create our fifth muzzle. And our new code texter. Let's export it. It will export directly to our project, and then we can replace here the texter. Let's see how this looks. All right. It's a little bit more on the sci fi side. Maybe the first color can be white and the second color can be red. And this is what we get. With just a couple of exposed parameters and a couple of new texts, we get some very different results. We could keep on exposing parameters and get even more crazier variations. So that's it. We hope you guys have enjoyed this. Feel free to check my profile. There's plenty more of these Visual Effects classes and lessons for you to learn from, and I hope to see you on the next one.