Basic Niagara UE4 Birds Flocking System

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in uh this short very short video um i will introduce you all the basic workflow to experiment a little bit with the some uh bird flocking behavior inside the the new uh nagara you pronounce system uh in a real form and uh hope you will enjoy in the end we will also experiment a little bit with the point force as very fast and very simple setup that i just came up uh experimenting a little bit with the systems and i think it can become pretty precise and interesting if you work with several forces and you use blueprints to drive a simulation you can simulate for example some basic avoidance and chase or attraction forces to get interesting movement inside your your birds and i will show you from sketchfab model how to how i just used a secondary uv map to drive the shader for the wind simulation and how to obtain some variation inside the different instances downloadable assets if you scroll down you can find flying crow blacksmith workshop asset i think works pretty well uh this one so you can download it is by can also you can download the blender file so if you go inside the flying crow blacksmiths workshop assets you can find some texture normal and ambient occlusion and you can find the original blender file we can open it and so we have our model we can check that it has a uv basically it has a uv layout so this works so you can directly change this one in this case the model it doesn't have a real texture for color and so on but maybe you have a more realistic bird and so you want to keep this however also this one has some textures so we can go inside the uv maps and create a winged mask another uv map we can switch to this one so we don't override this map and basically we want to uh map all the uv on a gradient we will use in a in the shader a gradient that will drive the vertex animation so basically we want this part so the attachment of the wing and the body to not move and gradually to move with the shader the vertices up and down to simulate the the wings the wing movement so basically we can select everything and go here and weld so uh we just put we will put them here don't go outside just uh stay for example here it's not it doesn't have to be precise at millimeter because we will keep at least this part black and then go towards white so now we can start to create the layout for the wings so basically we can select the edges and create the star the cut for our winged uv okay so mark sim and okay so not much sharp but works in okay then we cut this part and this part and we do the same here okay so we have the wings select them sorry let's use this the face mode faster pretty sure okay okay then here we can unwrap we have the wings so basically we have everything and the wings here and we can actually keep the wings rotate them want this one to be rotated like that and this one this one okay so we have our wings we can make that a little bit bigger the important thing of course it's not they can be in this channel overlapped because we have the original channel in this channel they can be overlapped but just to try to keep the this part on the black side you can also just put all the points in a straight line or maybe do like that for example select this point scale x 0 and they just align you can do also like that but i think it's not necessary but we can make them also overlap okay and the important thing is that they stay inside our uv map okay so we have our model we export it fbx and export directly okay now we go inside area we create the folder effect and we make a folder asset import import our flank row we don't want to generate the right map and we should check okay we have our uv channel one that works like that so basically we can check the model here and we can start to change to create a material you can say let me see bro we want to assign it directly inside the mesh okay so we have our burn and we can start to create the material so the basic step that i did was to work on world position offset so basically uh we can drop down a vector 3 so this will be the direction we want to move on the z-axis the third so basically we will use this as multiply scalar parameter that we call for the world position offset so basically if we say 10 here you can see that the model is a little bit upper you can say 250 more visible probably as you can see it's already moved because we made a parameter so as you can see now it's quite far from our place so we just turn to zero we will use uh basically this work position office cycle through all the vertices and move by this number we will use a sort of gradient to mask the thing so we can take the texture coordinate we can create a linear gradient so we can you can check the result in this way so basically if we multiply by a constant and we clamp it between zero and one we can increase the results or we can also if we want we can also use the contrast node contrast we promote the parameter and we say to for example okay and we can multiply this like this so basically if we change the movement in this way so you can see that if i add the movement it will be quite messy but because we just using the first channel of the coordinates but we need to apply the second channel in this way you can see that now movement is connected with this part of the wings you can change as you can see you can smooth the the contrast i think this way it's the original one and yeah a little bit contrast and of course this movement is too much because it will be in this way also so here we made the mask here we have the movement the movement we can check it with time multiply sorry yeah this one on the movement and we will have a secondary multiplied for time scale one as you can see it's really small but we can increase it and our birth flight we can increase the time scale to have faster or smaller i mean the um i think with the gradient you can change a little bit the the look can look better you can change maybe you can also make the uv a little bit bigger era so for now i think it it works pretty well because we will be seen from faster view it's not it's not a close view so we have our basic system for the the bird we will need to drive some stuff uh from the particle system so we will start to import our texture this to texture we can use it in this case we can use texture coordinate to be sure at zero and we can have the normal inside we can have the we can have a particle color form the base column and compile and check and we can then use change this not this one we can leave it like that but we can change this to uh with the dynamic parameter so basically we can have the first parameter can be times k second parameter can be movement third parameter can be we can add [Music] because if we use the same movement and time scale for all the birds it will just move the wings in the same way this is the main problem to give some differences to all the flocking system so we can add at least id variation one and we can that we will use for the time scale time and we cannot so basically we can multiply these two and the fourth value will be one okay we can multiply the second value is two we want the second value to be zero okay so this can be our times k and this will be our move so you can change this so i think that's enough for our uh material it's quite straight and we will use it inside the niagara so let's go here create a new folder system we can use nagara system new selected emitter we can start from fountain it's right simple and we call pt we open it and we place it directly inside the scene so we can have a better view so let's start from uh get read velocity cone get rid of gravity force then and we can we can try with the sphere location we can use also a box location but i think okay our birth maybe to be good say 100 okay so we can start to add um so the flux can do several stuff like uh going for example in the sky like that following a direction we want uh we try to make for this time some birds that just [Music] fly circular on an area so we will also make them appear and disappear very gently so it's basically we can use a certain amount of particles to keep the effects always alive just like environmental effects but you can then make them pass through the sky and so on is the same so we can inside particle update add the voltage force just uh it will say okay pay attention because if you um niagara works with the consequent stuff so if you put it uh after the sole forces it will be quite uh it will not calculate exactly so we can say this we don't want to amount too much i want basically that the the the burst doesn't stack in the center of the object so i want to pull them outside and something like that that will work we can so we want to spawn much less particle and we want them to leave more so in the initialized particle we can set between 10 and 20. we want that so basically it's the tweak the forces okay so you can see that when the particles phone they just uh they are stuck in a place and then the vortex force started to make them work so we want them to move a little bit and we can say uniform range vector we can say on the let's think that for example x and y are one direction so we can say between five and ten and then so when they spawn they just start to move they are starting to get in some interesting results a little bit more okay we can add a little bit more variation in the movement with the curved noise force if this error appears and you don't want to move by yourself you can do fix and basically it should work by itself we can increase a little bit current noise force it works seems seems to work so let's start to add our actual bird we drop down a mesh renderer we get rid of the sprite render we go inside our assets folder we drop down our birds and now as you can see a lot of birds coming in the same too much so let's say spawn rate five and let's start with facing velocity so basically as you can see it turns down in the velocity but the orientation is quite messy so in the particle spawn i think a good things of niagara is the steps you have the different part of the life so of the system so in the particle spawn we can say mesh orientation to vector and here we can try to experiment as you can see now our bird is completely messed up but we can say for example so it's not this one it's this one but now it goes back so minus one and here our birth are aligned finally okay very good so the uh the main problem with orientation that you have is that as you can see if you have some velocity uh change that appear to uh abruptly basically the the orientation of the model it looks strange but the fact that the beginning starts like that it's not so relevant for us in this case so we can [Music] we we should use the parameter now so you have two different way you can for example change the shader this is the shader sorry not this one i was wrong you can change this shader uh to draw to be driven by the time inside niagara i think in this way it's a little bit more tricky because i i tried to change the scene this new zoid [Music] the sinusoidal blueprint but i had some problems with the id it seems to cut to refresh some parameters each frame so i found that if you have a common time inside of the shader then we can add the beginning the multiplier that will change each instance so um i don't know if actually in this case i think it's not important the idea because we will not use uh there was a previous version in which i use it but i think this is more easy you can go to particles pawn and use dynamic parameter y in particular spawn because when the particle is spawned it will drive this and not on the update because it will change constantly so we have our time scale we can um do the time scale with dynamic inputs you can say uniform float so we can have one let's see 1.5 we can have a movement unit float between 20 and 30 let's see like that as you can see now our birds start to move the wings and they are pretty much um already different we can add more variation 1.25 and also okay then we can add the color sorry sorry it was wrong follow a color module here you can choose yes like this then you can see it's like because with this it's quite strange as you can see they change basically the color between the different birds i think the the ambient occlusion it's not so beautiful so we will get rid of it it doesn't add so much to the the bird oh they change the color we can use a little bit they are crawl at least they should be quite dark i think and so we have our chrome we have our color we can add a scale in this case i prefer to use multiply vector by float this will take the scale and multiply by float so you have basically a linear interpolation it's not because if you multiply if you change two vectors maybe you have some medium value between the the different axes and they change the scale but in this case you can then this is the great things of niagara you can add a secondary level of variation here and say okay just multiply between 0.25 and 1. so you have a secondary level of personalization inside the the scale of the mesh i think it works pretty well uh then i don't know it worked at the color i don't understand why they also think okay so you can add a secondary level of changing okay it was not selected okay effect was quite strange that didn't change okay we can increase the drag let's say one no too much okay i think the scale is a little bit too different between [Music] 0.5 0.5 here okay last step that i would like to add is the scale by no scale merged size should be like that this one can be also after the solving forces because you can say curve and we can add the value 0 we want to be zero at 0.1 we want to be one one okay again values to all the curves at the zero point eighty five we want to be one okay and at one we want to be zero for everybody so basically our birds appear and they populate of course if you don't like the fact that the birds just scale you can make them appear from one side and then came into the scene it's uh pretty the same but i think it's not so if it's for an environmental scene it's not so complex or so disturbing but you can always decide i think we are pretty okay i would just change a little bit the mesh size less variation too much variation and i want let's say 0.75 0. and we can increase things so we have a much deeper layer where the birds appear so this is uh the main system we went through uh i went through the the birds uh masking the the part of the body you can add several variations to all the the flying birds movement you can just try to change the different parameters however they are not moving the the i mean the the wings at the same time that uh it's quite interesting i like this movement and i must be sure i must be sincere um for an environmental effects i don't feel bad the appearance of the birth because it's just inside the movement but if you want you can also add some some stuff and uh you can also add some you can fake some avoidance by adding a point force for example that you can then drive with another element from blueprint maybe i will just do a video for that if i make it very strong as you can see now they just they are shocked as you can see they are shot outside so if i say minus 500 as you can see now they are attracted by our origin i'm just using the origin but i think the sorry as you can see you can simulate [Music] this and if you change dynamically the force for example i put zero you can drive this stuff from parameters for example in the bird flux system you can add the let's say float and we cannot i save because sometimes it's quite uh unstable and sometimes uh it's uh it crashed so um i can create rename force and rename position and then you can inside this sorry this one you can say okay this one will be driven by our user force and simulation position will be driven by our position and you can then animate all this stuff directly so now i it cooks every time but for example if you say okay no because it's a 0 zero if now we create a blueprint and inside the bird flocks we create a particle system effect uh we assign this one we create a sphere that we call point attraction we can inside the event graph forget the birds set yeah they are vector okay we should remember our this one position is called sorry it's called position and uh yeah name position and we can get our point of attraction that can be an object here compile same and in this case pay attention this will not change anything now because the blueprint works in play what's this but if we simulate the things now we should hopefully move the point of attraction and as you can see birds just move towards it yeah seems to work a little bit let's check yeah send to a position with the variable position if you go inside the blueprint the force was set to zero inside the pt birth you can also automate this process or change it but uh of course if it's zero the point of attraction doesn't work but as you can see now the birds follow completely the the point of attraction so you can simulate for example uh something that attracts the the birds and something that doesn't attract birds pay attention to that as you can see if we go closer to the center point they will be attracted if you want it to work with all the stuff [Music] increase the radius you you must use the radius but you can use it also for example to simulate a basic avoidance uh for example using 250 instead of as you can see now birth just escapes from it so you can use this to change the behavior of the flock okay i think uh this is a really really really simple and basic usage of uh flocking a system in niagara but i think it's a good starting point to create some more complex and interesting behaviors
Info
Channel: Guido Ponzini
Views: 13,482
Rating: undefined out of 5
Keywords: unreal, engine, ue4, niagara, birds, bird, flocks, flocking, particles, how, to, breakdown
Id: 10Rbtxsc3rU
Channel Id: undefined
Length: 56min 27sec (3387 seconds)
Published: Sat Jul 25 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.