House Modder's Tool Kit Explained

by Phaedra




Vince’s cabin, an example of what can be created with HMTK.
A sample plugin containing the cabin is included in the download.

This tutorial was originally written for Oblivion's Real Estate's December 2007 Newsletter.


Requirements:
NifSkope and basic knowledge of how to use it.
House Modder's Tool Kit by Vince Bly and completion of the tutorials included with it.


Introduction:
What is HMTK?  That is what you must be wondering.  The House Modder’s Tool Kit was made by Vince to serve as a tool for modders.  HMTK consists of the raw building blocks that you can use to create new objects.  In the download package you will find five basic shapes plus a bonus shape (primitives), a tutorial document with examples that you can follow along with, a readme, and an sample mod that includes new meshes and textures.  I highly recommend following along with the examples, trust me you will learn a lot in doing so.  After you finish the examples and are ready to create your own objects (if you are like me) you will wonder how to do the math.   Really, all that it takes is some simple math skills and knowing where to apply the numbers.   You will also need to know the starting dimensions of the primitives.  First, we will go through the primitives and their dimensions.


Shapes:



 HMTKRec1.nif




HMTKRec2.nif

HMTKRec1.nif - a 6-sided rectangle that uses only one texture.
HMTKRec2.nif - similar to Rec1 except that uses two textures, one texture on four sides and another texture on the ends.
Both share the same dimensions: X = 20, Y = 40, and Z = 60.





HMTKRec3.nif

HMTKRec3.nif - similar to HMTKRec2, except the four sides are beveled.
Its dimensions: X = 20, Y = 40, and Z = 20.





HMTKTri1.nif

HMTKTri1.nif - a 45 degree triangle that uses one texture for the two triangular shaped faces and a second texture on the three rectangular faces.
Its dimensions: X = 40, Y = 40, and Z = 20.





HMTKCyl1.nif





HMTKBonus.nif

HMTKCyl1.nif - a 16-sided cylinder with one texture for the rounded sides and a second for the two circle shaped faces.
HMTKBonus.nif - a 32-sided cylinder with the same texture mapping as HMTKCyl1.nif.
Both share the same dimensions: Radius (X & Z) = 10, and Y = 20.


Math Time:
Next comes the math.  We will use the numbers from Vince’s first example, Floor Tile, so that you can have a visual for comparison and hopefully a mesh.  (You did follow the examples, didn’t you?)

Step 1, Scaling the mesh.  The instructions are to scale the vertices on NiTriStrips, notice that all of the boxes default to a scale of 1.0. You are instructed to modify these to be X = 12.8, Y = 0.05, and Z = 4.2667.  He also gives you the final dimensions X = 256, Y = 2, and Z = 256.  How did he come up with the numbers?  You need to decide the final dimensions that you would like your mesh to have and then figure out the scale factor using the following equation.

X = NiTriStrips final dimension (Nfd) / NiTriStrips default dimension (Ndd) = NiTriStrips scale factor (Nsf)
or
X = Nfd / Ndd = Nsf

Plugging in the numbers from the example will look like this: X = 20 / 256 = 12.8, thus 12.8 is the scale factor for NiTriStipsX.  Use the same formula for Y and Z as well.

Step 2, apply the scale factors to bhkBoxShape.  This is where it gets confusing. bhkBoxShape already has numbers in its dimensions so it works a little differently.  The default numbers are X = 1.429, Y = 2.857, and Z = 4.286.  Using the bhkBoxShape’s dimensions and the NiTriStrips’ scale factor will allow us to calculate the bhkBoxShape’s scale factor.

X = bhkBoxShape default dimension (bdd) * NiTriStips scale factor (Nsf) = bhkBoxShape scale factor (bsf)
or
X = bdd * Nsf = bsf

Plugging in the numbers will look like this: X = 1.429 * 12.8 = 18.286, thus 18.286 is the scale factor for bhkBoxShape’s X. Use the same formula for Y and Z.

Step 3, apply texture and update radius per the example.  This completes the floor tile mesh.

The same equations used in this example can be applied to all of the meshes.  However, at the time of writing this article I was still puzzling out collision for the cylinders and triangles.  Luckily Oblivimonk at the Oblivion's Real Estate Forums offered an explaination for Cylinder Primitive Collision... there used to be a link to the forum here, but since the ORE Forum transferred to new hosting and became SKYRE Forums that post was lost.  Thankfully I saved a copy of his post in my personal notes!


Cylinder Primitive Collision Explained

by Oblivimonk


So, you want to make more stuff with Vince's Cylinder Primitive but the collision seems impossible to change correctly????

Despair no more. It's actually easier is some respects than working with the rectangles.

Okay. Now, you can still copy branches and adjust translation of those branches if you want to keep the textures from being stretched too much, just like with the rectangles. You can delete the nultiple collision blocks as well, leaving only the center to stretch out to cover the whole end-product. Or, you can simply stretch out the one piece (sides and ends) and adjust the collision.

I'm not going into how to stack multiple copies of branches for cylinders. It's exactly the same as with the rectangles, as shown in Vince's Ladder tutorial. I'm just telling you how to take that one collsion and stretch it to cover your mesh, however you made it. Okay?

Alright, let's get started.

1) Load up Vince's Cylinder primitive in Nifskope. Immediately save it as a new mesh.

2) Go ahead and adjust your sides and ends to the dimension you want. You can also make multiple branches of them and adjust their centers in the translation in the Details Block along the Y axis, if that's what you're wanting. It makes no difference for the collision.

For example, I'll go the simple route. I just want a stone column. Problem is, the primitive is way too short and lying on its side. I don't know for certain how long its Y axis is (the tube part of the cylinder) but it looks to be about 20 or 30. I know this because in Vince's Ladder tutorial. if you do the math on the changes he tells you to enter, it's radius (the x and Z axes) are roughly 10. 10 times 2 is a diameter of 20. The diameter looks roughly the same size as the length, maybe slightly shorter.

Anyhow, I want my pillar to be at least 200 high. I'd like it 40 wide. And I want it pointing up and down, not on its side. So here's a quick list for me to change the mesh to the size and position I want:

A) I click on the NiNode. In the Block Details, you will see rotation.

B) Make sure it says EULER. Change Y to 90. Just like rotating in CS, really.

C) Go to both Sides and Ends. Right-click, Transform, Scale Vertices. For the dimensions I want, I change X and Z to 2.0 and Y to 10.0, then Scale. Do this for your own desired dimensions in both Sides and Ends.

Great, now we have the dimensions we want but that collsion is way too small. Now we'll change that to cover our mesh.

3) Right-click bhkConvexVerticesShape.

4) Insert new block.

5) Go to Havok in the drop down menu, select bhkTrandformShape.

6) Go to bhkRigidBodyT. In the Details Block, set its shape (the top line) to the data line number for bhkTranformShape. If you did not add multiple primitives or delete any blocks, it's probably line 16.

7) Go to bhkTransformShape. If the Scale window pops up, exit it. In the Details Block, set its shape (top line) to the data line number for bhkConvexVerticesShape. In my case, that's line 15.

8) Now go back to bhkTransformShape again. Click the little icon and the scale window pops up.

9) You want the bottom three fields, ignore the top 6. You want to scale the collision, not change it's orientation or translation.

10) Unlike the rectangles, you don't need to divide by 14 and all that. Use exactly the same values you did when you scaled your Sides and Ends. For me, that was setting X to 2, Y to 10, and Z to 2.

11) Now Scale. Your collision should now be the same size and shape as your mesh.

12) Remember to go to your NiTriStripsData lines, right-click, Mesh, Update Center/Radius.

13) Remember to go to bhkConvexVerticesShape and adjust your Havok material to what you're making. Don't want a stone column that makes wood noises.

14) Save it and you're done.

This works just as well if you did multiple copied branches. You can delete all the collsion lines after the first branch, just keep those three to stretch out to cover the whole thing. If you used multiple branches, remember your collsion scaling will be different than your mesh scaling. For example, if I made my column with a second copy of it, it is no longer 10 times as long as the original, it is 20. I'd need to keep that in mind when I scale the collsion.


****************************************************

I did not double check to make I was right about how wide the cylinder primitive is.

It really doesn't matter because if it ends up too big, you can always scale it down in the CS. I was running off memory here.