Real-time destruction with Houdini and Unreal || Tutorial Part 02

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello in this video i'm going to show you part two of rhythm restriction with houdini and unreal so in part two i want to make something a bit more useful and complex so here i have the scene and i can basically shoot with a gun barricade so you can see where i shoot i will actually explode or break the barricade this will specifically only be in a few areas so as you can see like it's not everywhere and this can be useful for gameplay example like a good example could be borderlands or the division two so here under the division two you have like this coffer system and you maybe don't want to destroy destroy the whole barricade so we can specifically in houdini say where the destruction once needs to be and then we can focus where we need to simulate damage so before i start this video will also require you to have some basic understanding of houdini and unreal like blueprints so it's very useful in this video and also watch part one which is like a very basic overview of how to do a basic destruction so here i have my project and i can press play and i have the default starter gun from unreal and if you don't have this in your project you can go and import this and you can import the first first person blueprints so either make a new project or import them here as a first person blueprint so you can have the same result as i have then we also want to modify some of that blueprint so this is the base blueprint you see here and i added here a line trace by channel node so we'll shoot some rays so this is the only thing that i've added to the system so nothing else that i have changed there so basically whenever i click we will play the animation and then i will also shoot a ray between two points so we have sphere 1 and normal sphere so if i would go in my 3d view here we have sphere 1 we have and this is basically attached to my gun so i'm shooting from my gun to a certain point so to make things easy i just added a point here in my 3d view so this is basically how far i can shoot so everything that is farther from that from the spheres i cannot shoot or destroy so they have to be in between these two spheres so this is a simple way of setting up a ray trace you can also do other ways to shoot further and so on but this is just like a quite simple way of doing it i also added a debug mode and added the color yellow so every time i press play now i can basically shoot these yellow lines this is mainly like for debugging purposes nothing special there so it's just knowing where i shoot so make sure to enable here to debug into a duration so we can actually visually see where i'm actually shooting then the other part here is then our 3d geometry so i used some geometry from mega scans as you could see here this barrier is a mega scan model so you can get these as well you can make your own model you can make you can get your model from a current project you can use any model you have and follow along here with me then so this is what i'm going to use for my demonstration the barricade so with this barricade we can then click and create a destructible mesh as in the last video we just have here our destructible menu and of course we want to import or fbx chunks so we can have a custom fraction from houdini in here now let's jump into houdini and we're going to now first of all import our geometry so i'm going to use a file node import that fbx file then also i want to scale this down because it is always 100 units difference in skating so i'm going to scale this down by 100 so now my model is in a better scaling so you could see that here i'm having a quite large scale you can see the values on the grid like they are quite large a scale so if i would know skill is 100 units down it's like a more deep it's just like better units to work with here so i always like to do that just to make sure we are working consistently with units in different software now let's talk a bit about fracturing and we can use our fracturing from the last video so material fracture so that will work as well we can delete a second level and we can add some more fracturing here what we can also do to easily visualize the pieces is here click on the attribute you want to visualize so we can actually click on these different attributes and visualize them in the viewport so you can see this is now what we have and we notice that the destruction or the pieces are a bit placed weirdly like they are all more in the middle there separately and we can change maybe the noise uh here to a burden noise and i think that's a bit better a bit more like distributed along the shape so we don't have like specific clusters so it's everywhere but bigger pieces then i also want to show you some other ways of fracturing and another way you can do fracturing is by using the vornoise fracture this require a bit more work so we need to input custom points for fracturing so each point represents a piece a debris piece or trink so if i would place down a scatter and lower this to like 70 we then have 70 strings here so you can see we have also now fractured this quite similar to a material fracture but a bit in our own way so you can see this is another way of fracturing and once we change the points we will also change the fracturing we can also for example do a relaxation so relaxation means that the pieces are more equally distribute along the mesh so you can see that the pieces are a bit more equal in size or we can also for example place a transform and play around with the points so if i would now rotate or scale the points we will also influence our chunks here so you can see we can really start playing around with these fracturing types by just moving around points so that can be quite interesting sometimes to do now we can also make this a bit more advanced and bring a mask here now we can actually paint where i want more or less strings so here i'm going to paint the corners for more pieces and we can now have a mask attribute so you can see we have a mask and now instead of using that 7d points we can now in fill in our attribute so we can disable here force count and now we can just enable here an attribute and we can just type in or select our mask here and now we will have only points where our mask allows it to be so if i would increase unit density we are not coming out of our painted mask so you can see if i keep painting here the top side we have now more area for scattering so this can be really interesting overall if you want to have something super specific you can do that here as well so let's visualize that here and we can see that we have a lot of different smaller chunks at the corners of our geometry and then bigger chunks nearing the bottom so this can be overall interesting if you want for example the borders of your destructible mesh to be smaller and the core of your mesh needs to be bigger we can for example do something like that where we can manually figure out where things should be larger in size so that was one way now there is also another way that i want to show you and this one is also pretty interesting and that is called the boolean fracture so this is also a note here so we're going to plug in here our mesh again of course and we also then need some fracturing geometry or surface to calculate fractures from and we can do this by drawing so we can draw lines and curves before fracturing so here by default i can just like draw on this script this blue grid but i can also go to projection mode and set it to screen space so whenever i draw it will be based on my screen or camera angle so if i change my camera angle i would draw a different line so what i want to do now is to use the line this is just to simply reduce overlapping or close points so increase that and i also want to do a sweep node so give it some geometry so with the sweep note we're gonna have to change a few things and i want to be a ribbon and i want this to be only one column and the width needs to be larger i think it needs to be maybe five so we have like a large ribbon here so every time i draw i will basically draw this piece of geometry and i also want it to be rotated so i'm going to go scroll down and on the rotation we can then fill in here 90 degrees so we can now use this as input for my boolean fracture so i'm going to also make sure that my fuse has a decent value that will just help later on if you use this method so let's plug that in in the boolean fracture then and we can now basically cut pieces from my mesh by drawing and i'm going to visualize this by also using a exploit view here so explode view so you can see that we can now basically start cutting pieces so i'm going to go back to drawing maybe clear all the results and once i start drawing now i can cut my barrier in pieces this can be quite again useful way if you want to have something super specific you can just start drawing and cutting the geometry yourself this can also be something that might be interesting to you so as you can see we can draw that we can draw something super specific like if i only want that part of a corner you can do that as well so these are three ways that i just wanted to show you so each way has something interesting in there but i'm gonna now for now stick also with the material fracture but i just wanted to show you that there are so much possibilities for fracturing houdini but i'm gonna here stick with material fracture and prepare this for exporting so now back to our material fracture piece and we're gonna go to our labels and enable here the name so we can actually see our pieces back again here and i might increase the amount so maybe let's go to something like 80 so we have more geometry to work with and then i want to clean that up so i want to also merge specific parts together like like again maybe you want some still a cover spot for your gameplay or some art directable parts that doesn't need to be destroyed so i'm going to first of all assemble the model and with assemble i can pack the geometry so packing actually means that all the pieces are now represented by a point basically so they are all stored or packed in one so you can see here i have all the points and now i only have one point so with that is actually useful for selecting pieces procedurally so i can place them in group nodes and in this group node let's give it a better name like static and also want it to be a point group and this doesn't need to be base group i want to be bounding region so with the binding region i can automatically select pieces as good seen here that are inside that cube so if i generate something everything inside the cube will be seen as a static group so now i want to actually then make this a bit more advanced so we have different options to input custom options here so i can use my second input here and for example place a box myself so place box next to that here and i can plug that in over here and that will work but i also want to have a sphere so i can merge these together and i can use this as input so maybe let's change this shape here of the box and also from the sphere then so i only wanted the bottom to be selected and also the sphere here let's maybe turn this into a pulley and lower this and scale so i only have a distraction then in the corners so in the group itself i'm gonna have to change this from bounding box to binding object so we're gonna use our input object here and we can actually see a small issue here so when the two geometries my sphere and box are overlapping i actually have a issue with that it is not perfectly detecting these two together when overlapping so what we can do here to fix that is we can actually turn this into a volume so eyes to offset you can also just merge this with a boolean or do other things but i often would use here a volume so let's use a 50 in samples here so it's a bit more detailed and we're going to use that as our input now so i'm going to also change this then to bounding volume because this is now a volume so by default it's not working out of the box and we're gonna have to fill in here a one so iso's offset one and i'm also going to click then the invert because now i'm seeing the other the other result so when i invert i have my correct result and this is exactly what i sort of wanted so we only have now the sides not selected so i can procedurally now play around with the shapes and my group will automatically update so maybe i can drag down my sphere a bit lower and now i have this interesting shape so this is the part that is not being destroyed in game engine so this will be not destroyed so this is a way to art direct a bit the area of where i want it to be so if i wanted to be the corner i can just grab my sphere and you can see that the corner is now selected this is some basic procedural group selection now next up i want to clean up this geometry so if we look inside we've still seen that we have a lot of geometry from the fracturing so i want to make this bit more optimized we don't need all these chunks so i want to optimize and clean this model up so there are a few different ways of doing that and i'm going to use a way with only a few nodes so i'm going to use the cleanup destruction tool this will clean up the model and if i plug this in here it won't work out of the box because it is expecting a simulation of a destruction but right now we don't do any simulation so you can see by plugging this in here all the insights are automatically deleted and cleaned up so that's actually what i'm looking for is something that can clean up our tools here so what we can do here is we can for example do a small simulation so we can grab our bullet solver and we're gonna just set up a very simple simulation here so when i press play the box here of the my battery is falling down so what i want is a ground plane so ground plane so when i press play it will just like fall apart but i don't want all the pieces to be falling apart the static group doesn't need to be simulated and we can actually quite easily do that by defining a attribute called active so we're going to create a attribute and this attribute again this is only for static and we're going to call it active and active needs a value so when active is one it's simulating when active is zero it's not assimilating so we need to be very thoughtful of what we've learned here so i want to fill in one but i want to invert my static group so static doesn't need to be active so it's value zero so you can see here that now only the side pieces here are destroying or falling apart so now to make things a bit more interesting we need to add some force here in this step so let's fill in some values to work with mainly here in the gravity when i press play they just like fly off it doesn't have to be special but this is like the result that i want so if i plug this in now in the destruction tool in the construction cleanup i basically have the result that i wanted so if i go into the more into the mesh it's now cleaned up fully in the inside and i can clearly see that why the colored pieces will be unique and separated that's basically what i was looking for so only with a few notes i quickly cleaned this up a bit more so the less pieces the better probably for the game engine so it sometimes can be a good idea to clean up and also this can be also useful for art direction like some parts don't need to be destroyed some parts need to be larger so we can fake that here but in houdini already so the thing that i have not talked about is the uving so let's place a quick shade and start checking our uvs so here we have our uv that looks good but what if i do a exploit view so here let's check our uvs on the inside and they are okay but they could be better so we might want to build our own uv system they are not bad but they could probably be better so let's try and find a way of making this a bit better so what we can do is we can for example use the uv flatten so this will automatically then unwrap you can also use the r2u thing from labs which i can also highly recommend trying that out i'm just going to simply use here the uv flatten as example so i want to then only unwrap the inside pieces so i'm going to plug in my geometry now and in our uv view we can see we have unwrapped that piece so they all look like that but i also only want to unwrap the inside pieces here so the group is inside pieces so i'm going to keep my original result here so if i would now view this here this should be a bit better i mean it's still not perfect but it's definitely like a bit better in some areas so if i also view my evs here let me maybe grab this apart with the blast note so you can just simply blast away these inside pieces and then invert that this is my normal uv of my model and then this is my debris pieces of the inside so these look okay they are nicely flattened by node again you can also use the auto and wrapper from labs that will work as well so with that we can also maybe specifically target this in an area so we can use the layout node uv layout with the layout we can specifically say where the inside pieces need to be so i can also use the group here inside and i can use my handle and i can specifically merge or force this in a certain area so here if i want this to be in this specific area because this texture is used for that i can here do that so that can be quite useful so i'm going to use the area for my barricade texture as as well for my texture for the chunks here so this is then overlapping with each other so you can see that they are now in there and this is basically done the result so just these two uv nodes to quickly add some uh better uv in there and to make sure my uvs are getting transferred i'm gonna also uh enable here the uv transfer in the back geometry just to be sure that we have that so in the end we should output a new piece with uvs so here we see our final barricade and if we unpack this geometry because here this is still packed we should see now a piece with ruvs so you can see that we now have everything as it was before but now also a bit more cleaned up so maybe i can quickly go back here and tweak the uv space and then i have my new result here so that's basically it and we're almost done with the houdini part so let's talk let's think about using a fbx node and again from last video we need to use the attribute to define the exporting so we're going to use here pad so let's do pad here because the pieces are done separated let's give this also a proper location to save and also let's scale up our model back to 100 units so it's also important to do that as well so then we can click save we only we only need to render one frame that's also important we only need to render one current frame number one we don't need to render the whole timeline and then we can save that what is also interesting to do is we can also triangulate the model so we can use the divide node and in the divide node we can enable some triangulation so that can be very useful for complex geometry what we also notice here is that we are actually still working in a packed environment so that means that we cannot edit geometry directly so we need to unpack that geometry so if i unpack the geometry i can now actually see the total amount of polygons and we are basically done with our model so the cool thing about houdini is we can always go back and forth between nodes so i can go back to my original fracturing node and in there i can basically start changing values like i can change the scenes i can change the way the fracturing is done and so on now back in unreal let's go and import our model so i'm going to open my destruction mesh and i'm now going to click on import our fbx files so i'm going to select here my degree pieces import mistake moment and then here we have our model so we also need to add our materials back again now but we can see that we have our uh but we can see we have the exact same results in from houdini and unreal so that's worked perfectly so now let's go and scroll down and add our material under skeletal mesh we have here some options for materials so i'm going to use the same material from my original mask because it's the exact same one so you can just write it in there and there we have the destruction mesh this is what we had also in previous video but now i also want it to be actually a blueprint so i'm going to delete this back again in my scene and i'm going to create blueprints this can just be an actor just call it something like barrier destroying or destroyer and in that blueprint we can drag and drop a destructible mesh so now we have that mesh in there and the cool thing here about having a destructible mesh in the blueprint is that if i scroll all the way down here we can have custom events here for when something is fracturing or breaking that can be quite useful to have or to trigger something else so whenever the mesh is breaking we trigger something like a particle and so on so this can be quite interesting to just have in your blueprint so now i'm going to use my blueprint in the scene and not my destructible mesh so in the destructible mesh there might be some more settings we want to tweak so mainly talking about the damaged threshold so we can maybe increase that so it takes more damage for it to break and the damage spread i'm gonna leave it like that now we can also go a bit more down and we can also again fill in the support depth one so we have a bit more uh better simulation and what's also now interesting is if i switch to my depth one with all the chunks i can actually start clicking these strings so i can select for example my big string here and i can now say that this big chunk is a support that this doesn't need to be fractured don't take any damage and do not crumble so we can say that this return basically is quite static and will barely be destroyed or simulated and that's also the reason why in houdini i made this as one big chunk because now i can just click on this and say this is a support piece don't dis don't damage this we can also like select other pieces if you want to like you can also select multiple and also add them as support and not damaging but the main reason in here is just i have one piece click it say it support and done then one of the final things to do here is to actually write a logic when i shoot on this barrier it starts to break or falling apart and that is done in the blueprints here of the first person so here from the line trace we actually gonna use something that is called damage so we can apply damage on a point radius radius with falloff so we have different methods here for damaging so in my video here i'm going to use here then the point damage but you can play around with these other ones as well but i'm going to just simply use points so i'm going to only damage in that certain area where i should so let's plate it in over here and then we need some information to work with so if i would compile it we need more data to work with so first thing what we can do is we can link our hit with uh to hit results here that it needs so that's one part and then we also gonna break our head result so we have some more detail here so we have specific detail about the ray cost here so the damaged actor is the actor that is hit so whenever we hit that actor we apply some damage then also the location is basically the location of the impact and that's basically now done so now we are doing damage but what i've not set up is the amount of damage so it's currently zero so if i would play and if i shoot my barricade nothing is happening because i'm doing zero damage so we need to do more damage to start breaking this so if i would fill in the high value like 50 and now start playing i'm now being able to destroy this barricade as you can see we're now basically shooting and destroying that so what is important here with these damage numbers is if for example with now for them 10 this will not be destroyed and the reason for that is this is directly linked to my damaged threshold here so in here i had 20 damage so if i would now have 21 damage on my gun i'm able to destroy the barricade so this allows us to have specific damage values on different models or this allows us to have multiple guns or weapons with different damage properties so we can now start playing around with our damage number and have more variation for gameplay so every different gun or if i have a gun that charges we can then have different damage outputs but this is basically how you can set and do damage to that object now the final touch here would then be spawning a particle so for that we're gonna go back to our barrier and in our barrier we're gonna add the particle here you can also try and adding the particle here in the first person blueprint that's also possible but i'm going to specifically use the event here for fracturing so if we scroll down here all the way at the bottom we have this specific event on component fracturing so here we can actually spawn particles on that so if i would now type in spam and we're going to use spam system at location or emitter so emitter is the default particle that we're going to use system at location because i'm going to use the niagara systems so here we can now select particles and we can now use the hit points as my location and that will perfectly work so now let's talk a bit about the particle so here i have a basic particle and the way i've built this is by using the niagara system so i'm going to right click effects niagara system and i started from a template called the burst so here radial burst is basically the exact same particle that i've used as well so here if i open that we will now see like this burst so every time we hit the barrier it sort of like has that small explosion or burst that's what i basically have done so i actually made a few more tweaks to my version so if i you can see that we are actually bursting a model instead of a sprite so you can see that these are now like debris shrinks so you can see that i removed the sprite and i added a model so that makes it a bit more cooler so we actually have like small debris trunks there so you can see here is the default one from unreal so just add a mesh renderer what we can also do then is copy paste that burst and i use that burst also to then use as smoke so of course i set the velocity a bit slower so it's not like going all around but i basically used the same logic for that smoke as well but i also i can just recommend you checking out other tutorials for this for creating particles there are a lot of particle tutorials up there for unreal uh but this is like a basic view on that so here we can now use uh the particle so you can fill that in and that's now play and let's shoot that bash and that shoot our barricade so we can see that everything is now being destroyed and we are spoiling the particle so it's also cool now if i would shoot my big chunk at the bottom we are not spamming any particles or breaking anything because again this is set as a non-damaging actor and when i shoot here the top i'm able to destroy that so if i shoot somewhere else we're not doing any damage or spawning stuff so we only specifically damaged that barricade and this is basically how this is working so now right now we are done so we have a fully working system so we mainly here used again the apex destruction plug-in for unreal but in the future i'm looking forward to what the gale's system of india 5 will bring you can already try it out but i feel it's still a bit experimental it's not officially been released chaos but i'm definitely looking forward and maybe do a small revisit on some of this destruction so i hope you enjoyed this video thank you for watching feel free to like and subscribe see you on the next one you
Info
Channel: Simon Houdini
Views: 16,012
Rating: undefined out of 5
Keywords: Houdini, procedural, game, art, gamedev, unreal Engine, Apex, destruction, Barrier, Megascans, Quixel, Debris, Particles, Niagara, Smoke, Breaking, Shooting, FPS
Id: s4jCYRIXuAQ
Channel Id: undefined
Length: 34min 8sec (2048 seconds)
Published: Fri Apr 02 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.