Pivot Painter in Houdini for Unreal

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Well, I have a wonderful electronic invention. I want you to see Hello and welcome to another video. I'm Dave, and this is the first time we take a closer look at unreal on this channel. Houdini and unreal have great potential working together. And it is time to explore that section. Oh, it is about time. The kind of nonsense we are going to do. There's a lot more content for Houdini to unreal coming, but let's take a closer look at pivot painter. Pivot painter is a Tool in unreal that allows you to read data saved in UV channels or textures to manipulate pivot and rotations of the individual pieces of your mesh. Something where you would usually need a skeletal mesh animation can be done directly inside of the shader. This can save a lot of performance. Now to even start doing something with the concept, I need to give you a rough rundown of the mechanic and how it would Houdini can come into play. In January side-effects made an update on the labs tool to output data, to use that technique, and also made a video to explain it. To make sure that you already have the information that was given there. I'm going to recreate the steps to set up the foundation with a different Mesh example, but the beginning of this video will more or less contain the same information. You will find the link to that video in the description. And if you have already seen that, you can jump forward with the timestamps, but you can also stay with me. And we take it from the beginning. The idea is that you have your geometry in Houdini and want to prepare that it can be used in a shader in unreal. So let's create a simple mesh since this might interest some unreal people that are not too familiar with Houdini. We keep it simple. I want a grid of boxes with each box representing one piece of the mesh. So we'll create a box and a grid note, and we turn the grid from primitives to points. That allows me to use a copy to points, note, to place a box on each point. This workflow requires you to have UVS on your mesh. So placed down, uh, UV unwrap before the copy that gives us what we need on the box. And the copy will simply duplicate the UVS as well. This version of pivot pointer, we use the selection order to recognize which piece comes next. This information needs to be on the measure itself and on the pivot points in Houdini, we save bet on the point attributes, a simple way to do that is by squeezing in a wrangle before we copied the box onto the points. Inside the Wrangler we can use Houdini's coding language VEX to do a quick data tweaking. You can do a lot of it with other nodes without ever needing to learn vex. Much like you can use blueprints in unreal and avoid C++, But vex can be fun. I swear. So inside that wangle, I'm typing S @ hierarchy, which means this is a string attribute and it will hold root slash. And then at the point, number two, that string. The point number is a number. So I need to use itoa() to make it a string as well. He on the left in the spreadsheet. you can see how all the points now have that attribute with the root hierarchy inside. The copy node is copying all point attributes if they are not specifically avoided. So the hierarchy attribute is automatically transferred at the points of each box. now share one hierarchy name, but that only allows us to map the mesh and the pivot points that does not tell us the order of the pieces for that. We need another attribute with that information. The so-called selection index. It simply holds the information, which piece comes next, starting at zero. Something that sounds as if people use it often. And you can take a bet that Houdini has a note for that. The enumerate note does just vet tell her the name of your attribute and it counts the incoming type. And in this case, we need to go with ponds. As many already know. I love to do stuff in vex. Not because it's better, but because it brings me joy, but mainly I want to show that it doesn't matter how you solve a given task, like counting points in an attribute. Stop thinking about the, how, just think about the result you need to get. So here we need an integer counting points from zero. We very well could stay in the previous Wengel and just type I at selection index equals at PT numb pints in Houdini, start with zero as well. So this would do the exact same thing in this case. However, there was a good reason to route after this mode, because now this attribute was also copied over to the boxes. This would add an unnecessary step to exclude the attribute from the copy note. But still understand that in Houdini, you can do the same thing in a lot of different ways. In the end, you are simply manipulating data, be it with a note or in playing code, but we still have to do something on the points, which is actually easier with a Wangal. The points meet normals. So, but unreal can recognize on which X's pivots are supposed to be rotated on type in at N which is a known name for Houdini to hope the normal equals set zero zero one, which gives every point the same normal value pointing in one direction. Generally we create the side effects. Let's note. This is all hinges on the unwell pivot painter note for one, there is a difference how Houdini and unreal look at size. One unit in Houdini is one meter while unreal thinks in centimeters. So the tool directly scales the geometry up by 100. The pivot, paint painter two workflow uses textures to provide the information, the workflow that I wanted to experiment with. Uses the pivot positions with their selection order, enter texture, holding the normal information by default, this says X vector. And I kept it that way, even though appointed all the normals in the zit direction, it doesn't really matter. It is the shader in unreal that finds out where the normals are pointing it. Once I hit export, I get an FBX file. And the two textures, the namespace of the textures reflect the settings in this note that makes it easier to handle them later. The grid of boxes, it's a simple geometry. So there is not much information contained in this texture still. It's interesting how this allows and real to do what it does with it. But let's finally go there and see how it is applied. If you're starting out with unreal, one of the first steps you should take is to go to the learn tab, scroll a bit down and there, you will find the content examples. This is a great source to see how different things work and provide a wide range of examples. And of course, there's also a pivot painter example. From this page, you can directly create a new project from this asset pack. I already did that. So I jumped over to the library and jump in my own project. Yeah. Inside of unreal, you will find the MEPS folder. Each aspect of unreal is divided into its own map. Providing a series of ideas. There are two MIPS for the pivot painter tour. The first map contains many examples that use the older approach for pivot painter. One. They are still very interesting and offer ideas for the potential that the tool has. The other map here simply called pivot painter too, has some examples for pivot painter version too, like growing with hierarchy, depth, all the building of objects, which is what interested me, the good old Fortnite construction animation. One of the other big users, as you can see in the background is to bring life into your vegetation. But first let's look at that bid and object idea. We want to make the boxes appear, bring up your files and simply drag them over into the fold of your choice. This brings up the FBX import dialogue and is already provided by side effects. The important settings are what provide the information we want to bring over for the pivot painter. That is the Vertex color, which we want to replace and the normals that need to be important. We also want to convert the scene. Everything else can be left alone. Let's find a place for our grid to add another example to the room right here in the corner. Looks fine. There's one specific characteristic. When it comes to the textures, the default settings seem to distort the textures and missiles who have the data they hold. I again, will I on Paul's video where he explained which the correct settings. So we need to make sure that the compression setting is set to HDR. S RGB is off at the filter is set to nearest, which seems to have the most effect. We need to do that for the second texture as well. And now we come to the reason why we went to this map to test this here, we already have prepared pivot painter shaders that we can jump in for experiments. I want to look deeper into the build aspect. The magic is hidden behind the material. So click on the magnifying glass at the material to jump to it's folder. And here this, the built house shader, I'm going to copy it with control C, go back into my own test folder and pasted it. I can directly drag and drop this material onto my grid of boxes. It's not yet properly set up for that, but there's already something happening. The pieces already materialize, but there's obviously something wrong with it. So we need to tweak some settings to have a bit more control over the material. Let's create a material instance from the built house shader. This will allow us to override the parameters that were provided. We put the instance into the material slot and jump inside. The first basic information we need to adjust is the amount of pieces our geometry has. We're headed to a grid of 10 by 10 boxes. So we have 100 pieces. Also the boxes appeared quite rapidly. So we might want to turn down the speed. Let's turn it way down first, like 0.0, zero one. That might be way too slow, but we will see, well, that's obviously way too slow now, but it gives us an idea of how the Mex rotation permitter comes into play. So if we put that down to zero, we should see that there are no rotations at all, but if turned on, it is no surprise that the rotation looks wacky since we have not yet provided the correct pivot points yet the shader still works with the textures that are meant for the house. So now it's time to jump into the shader and start to poke around. And I assume this looks like all kinds of horrifying for some and business. Like you rule for others. Having spent quite some time in new Deni makes it a bit easier to see through no trees, but still as someone fairly fresh to unreal, I have to admit, it takes a moment to adjust. Luckily, since these shaders are meant as examples, they are very well organized and commented, but the most important information can be found right here at the beginning, the place where you provide your own textures. We want to do that within the material instance. So we're promote these texture, samplers to paramedics, and while you're here, it's a good idea to probably name them also right here. There's a good chance to mix them up. Otherwise again, I call this the X-Factor, but only because I caught the texture that way the pivot painter decode excess vector. That follows is what interprets, what normals were provided in Houdini. The second texture was meant for the pivot positions, and now we can jump back to the material instance and override the newly created paramedics. Since I only have a limited recording area, let me direct that window to the site so that you can see what I do next and how that reflects in the viewport. Pull all of the correct textures into their designated slots. You might think that the pure green textures, some are faulty, but if you remember all of our normals point in the same direction, so it makes sense to have this texture show only one color. And as you can see now, each box is placed one by one. The rotation also seems to rotate the boxes themselves, not rotate around to distant point. But it is a bit fast to actually see that here, you see them with five rotations and less speed. I really like this kind of approach. It provides a lot of options with only a little more data than only a synthetic mesh. But so far we didn't see much different from what side-effects already showed us. So let's try something else. I wanted to see if I can change the point where the objects appear from maybe an external source, like the player. I don't know how yet, but that's why I make videos like this so that I need to learn stuff and can show it to people. I made a duplicate from the shader and called it appear from player. We can again create the material instance right away for easier access to the pyramid or later. So let's again, jump inside the shader and try to find where appearing from player might be implemented. Somehow it all needs to come from the textures and end up in the world offset position of the material. He would get the selection order from the alpha channel. And this monstrosity uses that index to animate the pieces. In order as time passes, the frack node creates a series of infinite zero to one progressions. Those are multiplied with the total number, which makes this block pick one of the provided selection in disease. But the static position from where the object appears is straight forward, that position edit here by multiplying it to the result of the sequence animation. That's where we want to create another position. That position needs to be related to the actual position of the piece. The shader already uses that location for the rotations, with this absolute world position, we can steal that for our purpose, but that's obviously not the point where the objects should appear from. We need a tiny bit of victim F for that we are going to bring in the players location from outside the next step for now, we need to define a vector perimeter by holding V and clicking on the graph. For easy reference. We just call this location. This will be the player. The original shader used the vector perimeter as a fixed position. So a 400 in unreal zit excess means the blocks are falling from the sky. I however, need a position that just coming from the general direction of the player, but I also want to limit the reach of it. It shouldn't pop in from across the map. So how can we do that? First, we need a direction that is pointing away from the word position directly at the player to get that we need to subtract the position of our box from our players position. If we would use the result of that directly, we would get a problem that vector is as long as the distance between the two positions. So this would indeed throw the box across the whole level. To get control of the distance we normalize the result, the direction stays the same, but the length of the vector is reduced well in Houdini, it's reduced to one unit and I assume that it will do the same in unreal, but we can see that in a bit for ourself, that one unit would be a bit short to see the effect. So we multiply this direction by a distance that we can define on the material instance. And that's what we can connect to the previous offset location. Let's open the freshly created material instance and again, put in the correct textures and he here's the new location perimeter. Let's put the right amount of pieces in. Before I start playing with the distance I should bring in the player location. We can already assign the new material and it should make the blocks appear already in place. Since our distance is zero by default, not a bad effect either. We need to tell the level that this element needs to be updated. You could turn this into a blueprint itself or simply use the level blueprint. So let's do that for simplicity. Depending on what you do with the effect. The tick might not be the best choice you could think about using timers to handling the effect. But again, this is supposed to be quick and dirty. So let's use the dirty tick after all. This is a simple static measure of the level. So a direct the mesh from the word outliner into the graph and real uses a mechanic called dynamic materials, for instance, to manipulate shaders during runtime. And that's what we do here. Because of player is moving and his position needs to be updated for the shader, but we need that dynamic instance first. So create a dynamic instance for the static mesh that is behind the actor of our grid. Reconnect that to the event. And now we can choose a source material that should be dynamic. That's the appear from player instance. After that, we want to set the location, which is a vector pyramid of value of this dynamic material instance type in the name of the pyramid, or you want to update that location. And finally, we only need to grab the player's location. We can get that by getting the play upon and then get the actors location for the pond. The resulting vector goes into the value pin. And we're set. Let me, once again, give you a good look at the graph for reference a simple step, but yet really powerful. Now with that setup, we can go to the material instance and increase the distance. Let's start with four meters. The blocks do appear from a certain direction. But this should be the world center at the moment. We actually need to stop the game mode for the tick to update the location with the player. Let's go around the corner and take a look. The blocks seem to appear from the general direction of the player, but it is a bit quick to actually see it. So let's increase the distance and lower the speed so that we get a clear view of how the blocks are making their way and just really push this value up to really see it. This is a quite interesting effect. If combined with blueprints, this could allow for some interesting animations that again, a way cheaper than skeletal animations. Also interesting to note, if you want to get a clearer idea of how the shader is modifying the positions, it uses an opacity mask to hide all the pieces that are not yet in their place. You can simply disconnect a pin to that mask and see all pieces at all times that gives you a fairly weird looking effect, but it gives you an idea of what the blocks are doing that make me wonder how the shader react when explicitly not using the passage mask, wanting to animate pieces of your mesh. That's basically what the trees blowing in the wind too. But how about more mechanical shapes? Like these cubes? You could create some kind of machine that looks active. I also tried using a slightly more complex shape playing with their two positions and also trying to use different kinds of normal directions coming from Houdini. So I made a few more test shapes and did a few more iterations on the shader. Some things that I experimented with, where we mapping the time to assign curve value that makes the mesh switch smoothly between its two positions. Enter tested, applying the change to all pieces at once. And I also found out how to make sure that each piece does full rotations. When switching positions, I go over these examples in a longer version of this video available to my Patriots, but the basic principle stays the same as always the Deni five will be available for them as well. So I hope you enjoyed this first look at unreal on this channel and back next time chicks.
Info
Channel: David Kahl VFX
Views: 9,633
Rating: undefined out of 5
Keywords: Houdini, unreal engine, pivot painter, vertex animation, unreal engine 4, pivot painter tool, unreal engine animation, pivot painter houdini, unreal engine 4 beginner tutorial, pivot painter 2, pivot painter ue4, pivot painter 2.0, pivot painter 2 houdini, vertex animation vs skeletal animation, houdini tutorial, houdini to unreal, houdinie engine, david kahl, houdini vex tutorial, unreal engine games, vertex animation texture houdini, vertex animation texture unreal
Id: HKiLpX6OvAI
Channel Id: undefined
Length: 22min 53sec (1373 seconds)
Published: Fri Mar 26 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.