Создание эффекта трейла от меча в Unity

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hi everyone, in this video I will show you how to make such a sword-slash effect I already showed how to make a similar effect on my YouTube channel. And now I’ll show you how to make it much better. You can download shader for this slash effect for free on my Patreon page You can download my shaders for HDRP and URP for free from the Asset Store. Just google this: There are absolutely all the shaders that I use for all my effects. I'll start with the most basic. I will show how to create a model for this slash in a blender First add cylinder mesh. Set the same settings as mine. Be sure to check "Generate UV" Use Tab to enter in edit mode Press Ctrl+R Use you mouse wheel and click Then select the center cut Then select middle parts and change the size And reduce the size for the sides Use S+Z to decrease Z scale After that, go to standard mode (Tab) And select object > shade smooth And to eliminate artifacts, go to the "Normals" tab and set the option "Auto smooth" the model is ready But before importing models to Unity, rotate it by -90 degrees. Press Ctrl+A (Rotation and scale) And turn it back 90 degrees (R + X + -90) Then export as FBX Set "FBX all" to set scale to 1 create a new particle system after you drag model into Unity disable the Shape tab set burst to 1 speed must be 0, lifetime -+0.3 The slash lifetime depends on your animation select a model in the render mode tab set render alignment to local slash is look as follows with a standard particle material Make the slash fade out using the Color over lifetime tab. like this: and rotating check the "separate axis" checkbox in the "rotation over lifetime" tab Set the rotation for the slash depending on your animation in my case it is necessary that at the end of life the slash lose speed so I enable curve and select standard curve Now for this slash you need to create a shader. I will do a shader for this effect using the Amplify Shader Editor. You can download it in the Asset Store Just create new Amplify shader And select "Legacy/Particle alpha-blended shader" Settings do not need to be changed. They will immediately be what you need You can also remove "custom editor" and rename it You can immediately create material from the shader. And add it to the particle system. in the shader you need to add a texture node Add "Texture sample" node Next, you need to multiply this texture with a opacity value. Use float node for it Select "property" to have ability to change value in the material and rename it I set this value to 20 add this value to the "Clamp" node so that there are no artifacts before adding to color, create an append node XYZ is color, W is opacity You can also multiply end opacity value with "Vertex color" Vertex color is color from particle system And select your texture Any smoke texture is suitable here. Everything depends on your needs.= and from what textures you have. after that you need to add the following group of nodes to the shader: it will be a noise texture to dissolve the main This works as follows: By changing the float value, the dissolution value will change. and changing the value of 0.3 can dissolve the texture But I want to change these values from a particle system So I added texture coordinates. Set float4 I use "Register local var" and "Get local var" to transfer connections and compile it to see the results As you can see, the slash is transparent now That's because I connected the values of T and W in the shader. So you need to enable custom vertex stream and add Custom1.xy Enable "Custom data" Set mode to vector 4 and use first 2 components Y set to 1 An change X value using curve By changing X value you change the dissolution Just watch: From this value, approximately you need to make such a curve. In my case, it will be such a curve. For the dissolution effect, any noise texture is suitable. It depends on what textures you have and what effect you need. Depending on this texture, the effect will look different. In order not to lose time, I did not record this part on video. I created Vector 4 and added 2 values to append *you can miss 30 seconds* Use the panner to move in the texture. (It's tiling mode in Shader Graph) Connect panner to texture This way you can make the noise texture move. Just change Z value in the material. using these two values, you can make the texture move in a different directions Now the effect looks a little more interesting. The texture moves and that's all right. But each effect will be similar to the previous one. Therefore, the texture needs to make a random position. Add node "brake to components" and connect again using node "append" I just want to make a random position on one axis. I will add a random number to the Y value. A random number cannot be made in a shader. But this can be done using a particle system and pass this value to a shader. For this I use texture coordinates with vector 4 and "UV set = 2" Now you need to add the second texture coordinates to the particle system First you need to add "UV2" in a particle system and then add "Custom2.xy" Now shader values W and T = Custom data values X and Y Now enable Custom2 in the particle system. Select Vector And set Y value from 0 to 1 (it will be a random for each slash) And based on this random value, the texture will have a random position. Now you need to add a texture that will be responsible for the glow of the slash. for this you need to add another texture node It needs to be added to append. Now slash glows depending on the texture you choose. I use the texture of such a crater. It is dim now. Therefore, I need to increase the brightness. I want to make dark colors darker with a remap node I will set values using Vector4 Of course you need to use clamp node so that there are no artifacts All second values must be one. And add this to the exit At the tips the color is lighter but it is not as bright as we would like. Therefore, all this must be multiplied with some value. this value will be responsible for emission Use float node for this (Vector 1 in Shader Graph) I set value to "2" (but then I will change to 4.5) You also need to add Vertex Color to be able to change color using a particle system. in the float settings you need to set not constant but property To make the value appear in the material. This is more like sword slash But this is not exactly what I need. I will change remap value Now the angle is a little brighter. I don’t want the rest of the slash to be black so I will add color. So I will add color node Color must be added to the texture value. It also needs to be multiplied with Vertex Color. To also be able to change its color using a particle system. Now you can change the color using the material. I will make the color dark blue. It seems to me that I need to make the color a little darker. I also need to increase the brightness using the emission value Now is better Since the color depends on the texture, you need to do something so that you can change it. So you need "RGB to HSV" node and add value to HUE HUE is responsible for the color cast then add HSV to RGB Then connect value and saturation but HUE value must be edited Here you can add some value that will change color. I will make it possible to control this value from the particle system like this: W value from UV You can also add a desaturation node. So that you can make the texture black and white. I will rename this node... Now all this can be added to the output. And now changing this value you can change the color of the texture. You can have one material and change color only in the particle system. This is where the shader work is done. Although you can still move the noise texture. and to be able to move it, you need to select it in the texture coordinates since UV is connected to it now the slash seems a little sharper after that, some sparks can be added to the effect Set circle shape and rotate it 90 degrees radius thickness must be 0 set lifetime from 0.2 to 1 Size from 0.03 to 0.1 The color of the sparks should be the same as the slash from the sword. Do not forget to choose some bright material for sparks. set burst instead of rate over time set 15-20+ cycles set mode to loop speed let be 2 You can turn off the speed and adjust it using velocity over lifetime. You can add orbital speed and decrease it over time. Now particles are flying out very slowly, so they need to be accelerated. loop speed = 4 Turn them to the slash. Set render mode to stretched billboard And set length maybe to 5 You can also add limit velocity over lifetime I use curve for speed dumping You can set simulation speed to 2 to make them fly faster can make them disappear the main thing with the help of the size over lifetime tab I also need to double the duration because I increased simulation speed this way you can add smoke Just choose a different material for the smoke Just choose a different material for the house. and increase the size you need to set billboard mode for the smoke and reduce the speed The number of smoke particles can be made more or less. For smoke it is better to change not size but transparency. Distortion can be made in the same way Just copy the smoke and replace the material the radius must be made smaller for distortion particles These are particles that distort everything behind. Set sorting fudge to 2 for them this is necessary so that they do not distort the slash itself material for distortion can be done as follows: Just use standard Particles/Until material Enable distortion and set blend to 1 Remember to select a texture and a normal map. In the end, you can add to this effect hit. I use sparks for it And 2 flashes 1 is long and second is simple Sparks speed I set from 20 to 100 and I added "limit velocity" As I set speed scale 0.03, the faster the sparks fly, the longer they are. And now I will show how to make option 2 circular slash To do this, you can simply copy the main component. It's size and thickness needs to be slightly increased. the value in custom data which is responsible for dissolve can be reduced Then copy this component again and rotate it 180 degrees. the second component can be rotated 10 degrees Thus, such an effect was obtained. I will upload a shader to my Patreon page for free Because I understand that not everyone has the opportunity to buy Amplify Shader Editor. By the way, this shader works both on Universal and HD render pipeline. You can change colors and textures to see what works best for you. This way you can achieve completely different results. like this one: Thanks for watching and see you in the next video. Bye!)
Info
Channel: Hovl Studio
Views: 59,705
Rating: undefined out of 5
Keywords: unity, unity3d, юнити 3д, эффекты, particle system, партикл систем, game effect tutorial, игровой эффект, юнити эффект, erbgameart, vfx, fx, tutorial, guide, гайд, туториал, RealTimeVFX, sword slash, sword trail, слэш от меча, эффект удара мечем, slash, trail, след от меча, урок
Id: 5SosGQwPXdY
Channel Id: undefined
Length: 27min 2sec (1622 seconds)
Published: Wed Jul 01 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.