Real time procedural muzzle flash FXs in Blender 2.92

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi everyone in this step-by-step video i will show you how to create a real-time procedural muzzle flash using blender 2.92 this effect was created for my upcoming animation course second teaser if you haven't seen it already you will find the link in the description below this fx is rendered in eevee but before we go ahead don't forget to like this video to support the channel leave a nice comment if you're willing to and subscribe so that you won't miss more blender rigging and animation tutorials let's get started here is a steel frame of the effect we are going to use ev and i've activated the bloom so that we have a nice glowing the effect is boiled so that it will evolve through time whenever we switch frame it's a very basic mesh holding two different shaders the muzzle flash are the main flames that we can see from a side view and the muzzle flash front are these crown shaped flames that we can see from the front view those are assigned to simple lanes whether flat or slightly deform into a pyramidal shape elongated part of the mesh can be duplicated and rotated by a 180 degree on the y-axis so that it can be seen whether from the side or from an up and down view in the end we will attach this effect to a particle system before we get started i will just hide the current effects i have created i will add a new plane and move it into a new collection that will be used as our new effect so that i can build it from scratch and you can follow along i've called this plane muzzle front and i will move it into a new collection called fix new if you start from scratch you don't need to create this collection then i will go into edit mode and i will rotate this plane by 90 degree on the x-axis back into object mode i will move it in front of my minigun object with the object selected i will create a new material so i will go into the material tab name it muzzle flash front because this is the one we are going to see in front view from there i will open the shader editor and i will get rid of the principle bsdf because we won't be using it instead i will press shift a and add the shader emission shader a transparent shader and finally a mix shader i will then plug the emission shader in the lower slot and the transparent shader in the upper slot and i will plug the output into the output note that i'm using the node wrangler add-on we can't see any transparency on our plane and this is because we are not using the right type of shader into the setting of the shader we need to switch to alpha blend and we will get rid of the shadows since we don't want our flame to cast shadows now playing with the mix factor we can see that we get some transparency we will now create our first texture i will select the transparent bsdf and press ctrl t or you can go to the node wrangler tab and click on the add texture setup i will get rid of the image texture node and add instead in texture a gradient texture and i will choose quadratic sphere not quadratic in the mapping node i will switch from point to texture for the type by default when you add a plane in blender it's already unwrapped so if i check the uv editor i can see it as uvs and if i get back to my shader we can see that it's by default using the uv coordinates thanks to the node wrangler add-on if i ctrl shift click the gradient texture i can preview it as all before i will switch to quadratic sphere and we can see we have a round gradient that start from the bottom left corner of our plane by default the center of the gradient is set on the origin of the uvs when using uvs the coordinates goes from 0 to 1 on the x and y axis when using the type texture the point 0 0 on x and y is the bottom left corner and the point 1 and 1 on x and y is the top right corner to get our rounded shape in the middle we simply need to offset the location by 0.5 on x and y using the mapping node if i now use the result in the factor of the mix shader the black part will be transparent and the white will be pure emission so if i use a color ramp to contrast it you can see i get transparency by moving the different flags now that we have our base let's add some more details to our texture i will add a new texture noise and then i will control shift click it so that you can see what it looks like it's a simple procedural noise since i would like to manipulate its coordinate from its center i will press ctrl shift d to duplicate the mapping node and use it as the vector of this noise texture this way it has the same 0.5 and 0.5 offset on the x and y as for our gradient texture just duplicated the color ramp and put it on the output of the noise texture to have a more contrasted result if i now play with the global scale of the noise texture we can see that it's scaling from its center but i can also scale it through the mapping node on the separated x and y axis so what if i now use my gradient texture to manipulate the scale you can see that we have a scale variation following our gradient and if i invert the colors i get a stretched noise that really looks like the muzzle flash i have created to get better control instead of using a color ramp i will use converter map range it will take the value of our gradient texture that goes from black to white black being 0 white being 1 and convert it to whatever value we want by converting the minimum from 0 to 1 and the maximum from 1 to 0 i'm simply inverting the gradient and now if i plug it into the scale and i ctrl shift to click the color ramp of my noise texture i can see i get a distorted noise texture now you can play with the minimum and maximum value of the map range output to get the noise you want so from there we just need to mix this noise texture with our gradient texture i'm sorry but here i've lost a piece of the record but i've simply added a color mix color and i've plugged in the color ramp from our gradient texture and the color ramp from our noise texture if i now play with the factor of the mix rgb note we can see that i can switch from the gradient to the full noise texture now we can use two color ramp to modify the output of this mix rgb note one will be a black and white color ramp used to play with the transparency of the effect while the second one will be used to give color to our emission let's plug the first one into the factor of our mix shader and then ctrl shift to click the shader to see the result by changing the contrast moving the black flag we can see we get some transparency from there you can tweak the values of the scale of your noise at wheel play with the contrast of your noise texture or play with the mixing value between the noise and the quadratic gradient idea is to make sure that the edges of our plane are fully transparent so that we don't get our texture clipping with the boundaries of the plane now i will move the second color ramp node a little lower and i will plug its output into the color of the emission then you can set the colors of the color ramp flag to a more file like colors the white will be converted into a bright yellowish color while the black color will be converted to a bright orange or bright red you can add intermediate color if you want and then i will increase the strength of the emission to 17. now i will just tweak my colors the different contrast i will add a couple of layout reroute items that allow you to reshape a bit the noodles and arrange a bit on my nodes so that it looks a little clearer once you're happy with the shapes of your muzzle flash we need to make it move a little bit we need to give it variation through time and it's actually very easy getting back onto my noise texture if we zoom in we can switch the type to 4d blender will recompile the shader you can see the progression in the bottom of the screen the fourth dimension being time or evolution of the noise and we can change its evolution changing the w value and we can ask blender to automatically change this value on each frame by typing the hashtag frame this will tell blender to set the w value the same as the frame we're on when you're on frame 2 the w value will be 2. now the last thing to do is to give this a new shape so i will go into edit mode duplicate the plane and slightly offset it i will press ctrl t to convert it to two triangles select the opposite corners and press j this way i get my plane converted into four connected triangles i can select the corners and move them forward on the y-axis then back into edit mode i will slightly move inward this pyramidal shape so that it starts at the beginning of the canon of my minigun this tutorial is sponsored by myself if you want to learn all my rigging technique or if you want to create stylized character from scratch you will find all you need on my gumroad page use the code p2 design and get 10 on whatever product you want we now need to build our long flames to do so i will simply in edit mode add a new plane and i will make it longer on the y axis and offset it so that it starts from the tip of our minigun cannon i will then duplicate it in edit mode and rotate it by 90 degree on the y axis so that i get crossed faces from there i will add a new material slot to our object source our muzzle flash front and duplicate it and give it an order name like muzzle flash side then i will click the assign button to make sure that those two selected planes will get this new shader in this case we don't want to use the same crown shape for our effect so on this duplicated material i will get rid of the map range that drive the scale of the noise texture and we will first work on the shape of our current gradient the idea will be to change its shape along its length to do so we will play onits scale along the y-axis of the uvs as explained in the beginning of the video the uv coordinates goes from left to right and up and down with a value that goes from 0 to 1. so if i add a converter separate x y z and i plug in the uv coordinates and ctrl shift click it i will get a gradient that goes up and down for the x-coordinate and left to right from for the y-coordinate since we want to create a variation along the length of the flame we will use the y-coordinate of the uvs to drive the scale of our gradient to be able to modify this value we will need a converter color ramp the thing i want to do to start modifying the shape of the gradient is to slightly offset it toward the tip of the canon so i will slightly offset the y value in the mapping node from there since we have separated our uv coordinates we need to then recombine them through a converter combine x y z then plug my color ramp in the x value and since the scale value by default is 1 i will for the y and z value set a value of 1. now the cool thing is that moving the flags of the color ramp i can change the shape of my gradient from a rounded shape to a more cone shape if you want you can add other flags to your color ramp to create the silhouette of the flame the only thing to consider is to not make the white part of the gradient clipping with the upper and lower edges of the plane using different grayish values will make the shape larger or thinner i will then duplicate the color ramp and this time i will use it to drive the y scale i will simply use a black and white flag and move the white flag to the right the idea is just to avoid our silhouette to clip with the tip of the minigun try not to get any complex shapes here just keep it simple as we will mix it with a noise texture that will bring the complexity as we have our rough shape we now need to play with our noise texture i will control shift to click the mix shader so that i can preview our current material and it doesn't looks bad but we need to modify a bit the shape of the noise so that it feels like it's getting out of the minigun so i will select both the color ramp and both the separate and combine xyz node and press ctrl shift d and plug them into the scale of our noise we can now see that our flame get this slight cone shape i will just rearrange the color ramp node so that it's clearer and then i will ctrl shift to click the noise texture so that we can see only it and you will see the current shape of the noise so we can see our noise texture slightly distort as if it was getting out of the tip of our minigun canon first make a few modification on the color ramp that goes into the y value of the combine xyz the idea is to create some kind of wide angle spreading effect onto your noise pattern then repeat the process with the second color ramp that allow you to change the x scale value of the noise texture the idea is to make the noise pattern slightly thinner next to the tip of the minigun cannon and slightly wider as it gets further away again don't over commit to this tape you should have a look to your shader to see if it looks great because sometimes we spend a lot of time tweaking the noise but in the end we don't see all the details of the noise into our final shader when you think you're done with your shader you can go back into edit mode on the mesh and make the flame bigger if you will what i have done too is that i have duplicated those planes and i have made them thinner and longer so that it gives a more complex shape to my muzzle flash flames now we just need to bring some scale variation to our muzzle flash to make it looks more natural there are different way to do it but the simplest way is to use a particle system i will add a simple plane and in the overlay option i will enable the face orientation all our object meshes will be colored in red and blue blue being the positive direction of the normal of the surface so i will rotate the plane and make it very small so that it point forward in the minigun direction let's now go to the particle system create a new particle system that we will call muzzle flash and i will also call the particle setting muzzle flash by default it will emit a thousand particle from frame 1 to frame 200. so let's say we want to start the emission on frame 20 and we want to stop it on frame 80. we don't need our particle to leave and fall down so we will set their lifetime to only one frame they will appear and disappear on the next frame as a maximum we want only one particle per frame so 60 frame in this case but i advise you to set for example 40 frame so that you won't get a particle on each frame and the animation will kind of breathe now in the render properties we don't want to render a arrow but an object and we will select the object we have created now when i scrub in the timeline between frame 20 and 60 i can see my muzzle flash object being rendered let's crank up the scale to 1 and you can set the scale randomness between 0.5 and 1. it means the particle object will have a scale variation of 50 to 100 now let's fix the orientation of the particles first in the force field setting set the gravity to zero it doesn't really matter here because we have a lifetime of one frame but just in case and then active rotation and set it to velocity hair now the flames are aligned with the gun but pointing in the wrong direction since they are using the velocity of the particle to get their orientation we simply need to invert the velocity so i will set it to -1 and now the flames are pointing in the right direction you can now play with the different properties of your emission if you want more particle or to make this shot a little longer you can also modify the scalar randomness of the scale value if you want bigger flame depending on your model or on the kind of muzzle flash you are looking for from there to make sure that the emitter doesn't appear just uncheck show emitter in the particle system properties or what i've done to make sure that it doesn't appear even in my preview is to give the emitter a material set it to alpha blend and then set the alpha of the principal bsdf to zero in the video i've also added some bullets effects so those are simple planes in the cross shape with a simple gradient texture driving an emission shader and then on my emitter i've simply created a second particle system give it a very high speed some randomness and used those bullets as the rendered object this is the end of this video i hope you've enjoyed it don't forget to like and subscribe and i will see you in the next one you
Info
Channel: Pierrick Picaut
Views: 40,267
Rating: undefined out of 5
Keywords: blender3D, modeling, shading, rigging, B3D, p2design, sculpting, digital, animation, cartooning, rendering, CYCLES, tutorial, Pierrick, Picaut, Pieriko, 3D, Computer, Graphic, blender, eevee, VIDEO GAME, rig, animate, stylised, best, Blender
Id: eAPS27Vw3OE
Channel Id: undefined
Length: 22min 27sec (1347 seconds)
Published: Mon Apr 05 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.