Thursday, October 24, 2019

Week 4.1 - Houdini, Coding and Destruction

After wrapping up the first formative hand-in I decided to dedicate the second project to learning Houdini, or well, getting started learning it. Fortunately since I am familiar with node-based tools working with it is quite intuitive, as well as using Houdini's scripting language VEX, since it is really close to C/C++, which I have used in the past.Topic of my second brief will be destruction.

1 - Crate Generator 1.0 and 2.0
As my first destructible object I wanted to have some crates and started building a procedural generator in Houdini and created Version 1.0, which was mainly for getting used to Houdini's workflow. The only difference to Version 2.0 is, that I added the option to bevel the edges and fixed the Normals afterwards. I discarded that feature to reduce the tri-count. It also lacks the variation I added to Version 2.0, since I used "Copy" instead of "Copy Stamp".

Crate Generator 1.0
Well,I wasn't too happy with the result, as again the elements lacked variation (scale, rotation etc). So I decided to get more familiar with the "Copy Stamp" which in my case uses Points to determine copy locations. I ended up generating the point locations for the planks and posts via Code in "Attribute Wrangle" nodes and since I wanted to learn VEX I put everything into algorithms instead of manually defining locations. Once I know more about VEX I'll probably go back and optimise the code.

Corner Posts:


VEX Corner Locations
With this you can also change whether those corner posts are supposed to be on the inside of the corners or not.

Changing Corner Location
I also ended up procedurally selecting the top faces so I could add some Variation to their width.
Grouping Top Faces

Corner Post Nodes

Plank Locations:
I divided the Planks into Front and Side Planks, but I might combine once I have figured out transformation matrices.
Otherwise the code is almost identical. Basically the number of planks gets calculated based on plank width, distance between planks and crate height. Then by using the for-each metadata I can add random rotation to the planks.

Front Plank Locations VEX

Side Plank Locations VEX
Planks Node Setup
And here the code in action:

Planks Location

Small Support Posts:
I also wanted the option to have some smaller posts on the inside of the crate. Here I created the positions in one go, because orientation wasn't an issue. In this case you can change the amount of posts and based on that the gaps in between them gets calculated.

Small Post Location VEX
Small Post Location
Now throwing all those elements together results in the following crate generator.



Also for creating a destructible version I made a fractured version of the crate, Fracture Amount is tied to a Parameter.

Fracture
The node network itself is fairly simple and looks like this.

And that's it for now
Of course I then moved on to bringing those boxes into Unreal to see how they'd work as destructible Meshes. One problem I ran into is, that we currently do not have the Houdini Engine Version an Uni, so Houdini files can't be imported into Unreal, which gets rid of the whole procedural Factor, but apparently that is in work, so I might be able to do this towards the end of this project.
Also Unreal 4.21 seems to have a bug in the Destructible Meshes and the inside of the generated Chunks doesn't get a second Material ID assigned. I tried doing it manually to the fractured mesh, but on importing it Unreal doesn't consider the IDs.
Nevertheless, here is a video of how it currently looks.

DESTRUCTION!!!

No comments:

Post a Comment