Difference between revisions of "NifSkope: Adding Collision Model"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Entim
m
imported>Entim
(added links to tutorials, resized thumbs)
Line 7: Line 7:
*A BSA unpacker, for example [[BSA Commander]] or [[TES4BSA]] to unpack NIF files.
*A BSA unpacker, for example [[BSA Commander]] or [[TES4BSA]] to unpack NIF files.
*The latest version of [[NifSkope]] to edit the NIF files. The example screenshots of this guide were taken from the 0.9.3 version.
*The latest version of [[NifSkope]] to edit the NIF files. The example screenshots of this guide were taken from the 0.9.3 version.
*A 3D modeller software, for example [[Blender]].
Tutorials for these tools:
TES4BSA: [[BSA Unpacker Tutorial]]
NifSkope: [http://www.niftools.org/wiki/index.php/NifSkope NifSkope Documentation and Tutorials]
Blender: [http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro Blender 3D: Noob to Pro], [http://www.niftools.org/wiki/index.php/Blender/Configuration NIF Scripts Configuration]


===Preparation===
===Preparation===
*Make your model in your 3d modeller application, for example [[Blender]].
*Make your model in your 3D modeller application.
*Create the low-poly version of the model without any texturing or material settings.
*Create the low-poly version of the model without any texturing or material settings.
*Export these models in [[NIF_Importers_and_Exporters|NIF]] or [http://www.niftools.org/wiki/index.php/NifSkope/Mesh_import_export OBJ] format.
*Export these models in [[NIF_Importers_and_Exporters|NIF]] or [http://www.niftools.org/wiki/index.php/NifSkope/Mesh_import_export OBJ] format.
*Unpack ''\data\meshes\dungeons\ayleidruins\exterior\arstatue01.nif'' from ''\Oblivion\Data\meshes.bsa''. If you don't know how to do it, read the [[BSA Unpacker Tutorial]].
*Unpack ''\data\meshes\dungeons\ayleidruins\exterior\arstatue01.nif'' from ''\Oblivion\Data\meshes.bsa''.




Line 21: Line 28:
*Start NifSkope.
*Start NifSkope.
*Enable '''Block Details''' in the '''View''' menu, or push '''F2'''.
*Enable '''Block Details''' in the '''View''' menu, or push '''F2'''.
*In the '''File''' menu choose '''Load''', and navigate to the folder where you have unpacked the ''arstatue01.nif''. Open this file. You have done everything right so far if a statue of a man with a bird on his shoulder appears on the preview window.
*In the '''File''' menu choose '''Load''', and navigate to the folder where you have unpacked the ''arstatue01.nif''. Open this file. You have done everything right so far if a statue of a man with a bird on his shoulder appears on the render window.
*In the '''File''' menu choose '''New Window'''. This will start another instance of NifSkope. Load your high-poly model here.
*In the '''File''' menu choose '''New Window'''. This will start another instance of NifSkope. Load your high-poly model here.
**If you have exported your model in NIF format, load it the same way as the arstatue01.nif.
**If you have exported your model in NIF format, load it the same way as the arstatue01.nif.
Line 27: Line 34:
*Open a '''New Window''' again, and load the low-poly model here.
*Open a '''New Window''' again, and load the low-poly model here.


In every instance of NifSkope you should see the appropriate model in the Preview window, a Block List window, and a Block Details window.
In every instance of NifSkope you should see the appropriate model in the render window, a Block List window, and a Block Details window.


===Preparing the arstatue01 model===
===Preparing the arstatue01 model===
Line 34: Line 41:


*Swich to the instance of NifSkope where ''arstatue01.nif'' was loaded. This will be your final model at the end of the process, so save it with a different name.
*Swich to the instance of NifSkope where ''arstatue01.nif'' was loaded. This will be your final model at the end of the process, so save it with a different name.
[[image:CollTut01.gif|right|thumb]]
[[image:CollTut01.gif|100px|right|thumb]]
*Expand '''0 NiNode''' block on the Block List window, and right-click on '''7 NiTriStrips'''. Choose '''Block -> Remove Branch''' from the pop-up menu. The 7 NiTriStrips block should be gone. Remove the remaining four NiTriStrips blocks. These blocks contained every information of the model (geometry, textures, material properties), except the collision data. The remaining red wireframe represents the collision geometry. Enable '''Draw Havok''' in the '''View''' menu if you can't see it.
*Expand '''0 NiNode''' block on the Block List window, and right-click on '''7 NiTriStrips'''. Choose '''Block -> Remove Branch''' from the pop-up menu. The 7 NiTriStrips block should be gone. Remove the remaining four NiTriStrips blocks. These blocks contained every information of the model (geometry, textures, material properties), except the collision data. The remaining red wireframe represents the collision geometry. Enable '''Draw Havok''' in the '''View''' menu if you can't see it.
[[Image:CollTut06.gif|right|thumb]]
[[Image:CollTut06.gif|100px|right|thumb]]
*Navigate to the '''3 NiTriStripsData''' block, and choose '''Block -> Remove''' after right-clicking. This block contains the collision geometry data. The preview window should be empty now.
*Navigate to the '''3 NiTriStripsData''' block, and choose '''Block -> Remove''' after right-clicking. This block contains the collision geometry data. The render window should be empty now.
[[Image:CollTut02.gif|right|thumb]]
[[Image:CollTut02.gif|100px|right|thumb]]
*Select '''5 bhkRigidBodyT''' block in the '''Block List''' window, and double-click on the '''Value''' of the '''Translation''' in the '''Block Details''' window. Set x, y, and z to zero. This positions the collision geometry to the origo.
*Select '''5 bhkRigidBodyT''' block in the '''Block List''' window, and double-click on the '''Value''' of the '''Translation''' in the '''Block Details''' window. Set x, y, and z to zero. This positions the collision geometry to the origo.




Line 54: Line 56:


*Switch to the instance of NifSkope where you loaded your low-poly model.
*Switch to the instance of NifSkope where you loaded your low-poly model.
[[Image:CollTut07.gif|right|thumb]]
[[Image:CollTut07.gif|100px|right|thumb]]
*Expand the '''0 NiNode''' block. If you exported only the geometry of the model, it contains one '''NiTriShape''' and one '''NiTriShapeData''' block. Right-click on the '''NiTriShape''' block, and choose '''Mesh -> Make Normals''' from the menu.
*Expand the '''0 NiNode''' block. If you exported only the geometry of the model, it contains one '''NiTriShape''' and one '''NiTriShapeData''' block. Right-click on the '''NiTriShape''' block, and choose '''Mesh -> Make Normals''' from the menu.
[[Image:CollTut08.gif|right|thumb]]
[[Image:CollTut08.gif|100px|right|thumb]]
*Right-click on the '''NiTriShape''' block again, and choose '''Mesh -> Strippify''' from the menu. This converts the the geometry from triangles to strips. Strippifying is needed becouse the collision geometry of ''arstatue01.nif'' was built from strips, and the low-poly model's geometry is going to replace it.
*Right-click on the '''NiTriShape''' block again, and choose '''Mesh -> Strippify''' from the menu. This converts the the geometry from triangles to strips. Strippifying is needed becouse the collision geometry of ''arstatue01.nif'' was built from strips, and the low-poly model's geometry is going to replace it.
*Reset the '''Translation''' in the '''Block Details''' window if it is not zero.
*Reset the '''Translation''' in the '''Block Details''' window if it is not zero.




===Importing the new data===
===Importing the new data===


[[Image:CollTut03.gif|right|thumb]]
[[Image:CollTut03.gif|100px|right|thumb]]
*Switch to your high-poly model. Select the '''NiTriShape''' block. Reset the '''Translation''' in the '''Block Details''' window if it is not zero. Right-click on the '''NiTriShape''' block, and choose '''Block -> Copy Branch''' from the menu.
*Switch to your high-poly model. Select the '''NiTriShape''' block. Reset the '''Translation''' in the '''Block Details''' window if it is not zero. Right-click on the '''NiTriShape''' block, and choose '''Block -> Copy Branch''' from the menu.
[[Image:CollTut04.gif|right|thumb]]
[[Image:CollTut04.gif|100px|right|thumb]]
[[Image:CollTut05.gif|right|thumb]]
[[Image:CollTut05.gif|100px|right|thumb]]
*Switch back to the cleaned NIF (which was ''arstatue01.nif''). Right-click on '''0 NiNode''' and choose '''Block -> Paste Branch'''. NifSkope will probably argue about NIF versions, choose '''Continue'''. The geometry, texture, material data of the high-poly model is pasted in now.
*Switch back to the cleaned NIF (which was ''arstatue01.nif''). Right-click on '''0 NiNode''' and choose '''Block -> Paste Branch'''. NifSkope will probably argue about NIF versions, choose '''Continue'''. The geometry, texture, material data of the high-poly model is pasted in now.
[[Image:CollTut09.gif|right|thumb]]
[[Image:CollTut09.gif|100px|right|thumb]]
*Switch to your low-poly model. Right-click on the '''NiTriStripsData''' block, and choose '''Block -> Copy'''.
*Switch to your low-poly model. Right-click on the '''NiTriStripsData''' block, and choose '''Block -> Copy'''.
[[Image:CollTut10.gif|right|thumb]]
[[Image:CollTut10.gif|100px|right|thumb]]
*Switch back to the cleaned NIF. Right-click on the '''0 NiNode''' block, and choose '''Block -> Paste'''. Choose Continue again if NifSkope argues about the NIF version.
*Switch back to the cleaned NIF. Right-click on the '''0 NiNode''' block, and choose '''Block -> Paste'''. Choose Continue again if NifSkope argues about the NIF version.
[[Image:CollTut11.gif|right|thumb]]
[[Image:CollTut11.gif|100px|right|thumb]]
*Select the '''4 bhkNiTriStripsShape'''. Double-click on the '''Value''' of the '''Strips Data''' entry in the '''Block Details''' window, and enter the reference number of the new NiTriStripsData ('''1'''). The low-poly model's geometry data is now linked to the collision shape.
*Select the '''4 bhkNiTriStripsShape'''. Double-click on the '''Value''' of the '''Strips Data''' entry in the '''Block Details''' window, and enter the reference number of the new NiTriStripsData ('''1'''). The low-poly model's geometry data is now linked to the collision shape.
[[Image:CollTut15.gif|right|thumb]]
[[Image:CollTut15.gif|100px|right|thumb]]
*The collision data blocks must be in a specific order, which the NiTriStripsData doesn't fit in yet. Right-click on the '''1 NiTriStripsData''' block, and choose '''Block -> Move Down'''. Notice the reference number has changed to '''2'''. Repeat the '''Move Down''', so the number becomes '''3'''.
*The collision data blocks must be in a specific order, which the NiTriStripsData doesn't fit in yet. Right-click on the '''1 NiTriStripsData''' block, and choose '''Block -> Move Down'''. Notice the reference number has changed to '''2'''. Repeat the '''Move Down''', so the number becomes '''3'''.
*Save the NIF.
*Save the NIF.




Line 97: Line 93:
===Material setting===
===Material setting===


[[Image:CollTut13.gif|right|thumb]]
[[Image:CollTut13.gif|100px|right|thumb]]
Select '''4 bhkNiTriStripsShape''' block. Double-click on the '''Value''' of the '''Material''' entry (currently '''HAV_MAT_STONE'''). You get a drop-down list of available materials. Choose the material from the list, or enter the appropriate number which can be found [http://niftools.sourceforge.net/docsys/index.php?mode=list&table=attr&block_id=383&version=335544325 here]. This setting controls the hit sound, step sound, and arrow penetrability of the surface.
Select '''4 bhkNiTriStripsShape''' block. Double-click on the '''Value''' of the '''Material''' entry (currently '''HAV_MAT_STONE'''). You get a drop-down list of available materials. Choose the material from the list, or enter the appropriate number which can be found [http://niftools.sourceforge.net/docsys/index.php?mode=list&table=attr&block_id=383&version=335544325 here]. This setting controls the hit sound, step sound, and arrow penetrability of the surface.




Line 118: Line 105:
===Collision properties===
===Collision properties===


[[Image:CollTut12.gif|right|thumb]]
[[Image:CollTut12.gif|100px|right|thumb]]
Select the '''5 bhkRigidBodyT''' block. Interesting properties are marked with red dots on the picture. A list of all available properties is [http://niftools.sourceforge.net/docsys/index.php?mode=list&table=attr&block_id=317&version=335544325 here]
Select the '''5 bhkRigidBodyT''' block. Interesting properties are marked with red dots on the picture. A list of all available properties is [http://niftools.sourceforge.net/docsys/index.php?mode=list&table=attr&block_id=317&version=335544325 here]



Revision as of 12:56, 19 September 2006

The purpose of this article is to give a step by step guide to the Better Collision Modelling method described in Finessing Physics tutorial. The goal of the process is to create a simple model properly interacting with it's environment.


Getting Started

Required tools

  • A BSA unpacker, for example BSA Commander or TES4BSA to unpack NIF files.
  • The latest version of NifSkope to edit the NIF files. The example screenshots of this guide were taken from the 0.9.3 version.
  • A 3D modeller software, for example Blender.
Tutorials for these tools:

TES4BSA: BSA Unpacker Tutorial
NifSkope: NifSkope Documentation and Tutorials
Blender: Blender 3D: Noob to Pro, NIF Scripts Configuration

Preparation

  • Make your model in your 3D modeller application.
  • Create the low-poly version of the model without any texturing or material settings.
  • Export these models in NIF or OBJ format.
  • Unpack \data\meshes\dungeons\ayleidruins\exterior\arstatue01.nif from \Oblivion\Data\meshes.bsa.


Adding Collision Model

Loading your models in NifSkope

  • Start NifSkope.
  • Enable Block Details in the View menu, or push F2.
  • In the File menu choose Load, and navigate to the folder where you have unpacked the arstatue01.nif. Open this file. You have done everything right so far if a statue of a man with a bird on his shoulder appears on the render window.
  • In the File menu choose New Window. This will start another instance of NifSkope. Load your high-poly model here.
    • If you have exported your model in NIF format, load it the same way as the arstatue01.nif.
    • If you have exported your model in OBJ format, import it from the Spells -> .OBJ -> Import Multi menu.
  • Open a New Window again, and load the low-poly model here.

In every instance of NifSkope you should see the appropriate model in the render window, a Block List window, and a Block Details window.

Preparing the arstatue01 model

The arstatue01.nif was chosen becouse it's collision geometry data format allows importing custom made models' geometry. You are going to import your high-poly and low-poly models' data into this file, but first the unneccessary data need to be removed.

  • Swich to the instance of NifSkope where arstatue01.nif was loaded. This will be your final model at the end of the process, so save it with a different name.
  • Expand 0 NiNode block on the Block List window, and right-click on 7 NiTriStrips. Choose Block -> Remove Branch from the pop-up menu. The 7 NiTriStrips block should be gone. Remove the remaining four NiTriStrips blocks. These blocks contained every information of the model (geometry, textures, material properties), except the collision data. The remaining red wireframe represents the collision geometry. Enable Draw Havok in the View menu if you can't see it.
  • Navigate to the 3 NiTriStripsData block, and choose Block -> Remove after right-clicking. This block contains the collision geometry data. The render window should be empty now.
  • Select 5 bhkRigidBodyT block in the Block List window, and double-click on the Value of the Translation in the Block Details window. Set x, y, and z to zero. This positions the collision geometry to the origo.




Preparing the low-poly model

  • Switch to the instance of NifSkope where you loaded your low-poly model.
  • Expand the 0 NiNode block. If you exported only the geometry of the model, it contains one NiTriShape and one NiTriShapeData block. Right-click on the NiTriShape block, and choose Mesh -> Make Normals from the menu.
  • Right-click on the NiTriShape block again, and choose Mesh -> Strippify from the menu. This converts the the geometry from triangles to strips. Strippifying is needed becouse the collision geometry of arstatue01.nif was built from strips, and the low-poly model's geometry is going to replace it.
  • Reset the Translation in the Block Details window if it is not zero.


Importing the new data

  • Switch to your high-poly model. Select the NiTriShape block. Reset the Translation in the Block Details window if it is not zero. Right-click on the NiTriShape block, and choose Block -> Copy Branch from the menu.
  • Switch back to the cleaned NIF (which was arstatue01.nif). Right-click on 0 NiNode and choose Block -> Paste Branch. NifSkope will probably argue about NIF versions, choose Continue. The geometry, texture, material data of the high-poly model is pasted in now.
  • Switch to your low-poly model. Right-click on the NiTriStripsData block, and choose Block -> Copy.
  • Switch back to the cleaned NIF. Right-click on the 0 NiNode block, and choose Block -> Paste. Choose Continue again if NifSkope argues about the NIF version.
  • Select the 4 bhkNiTriStripsShape. Double-click on the Value of the Strips Data entry in the Block Details window, and enter the reference number of the new NiTriStripsData (1). The low-poly model's geometry data is now linked to the collision shape.
  • The collision data blocks must be in a specific order, which the NiTriStripsData doesn't fit in yet. Right-click on the 1 NiTriStripsData block, and choose Block -> Move Down. Notice the reference number has changed to 2. Repeat the Move Down, so the number becomes 3.
  • Save the NIF.





Refining Collision Properties

Now your model has working collision geometry, but it's material properties (mobility, hit sound, arrow penetration) are inherited from the statue. It sounds like stone when hit, arrows bounce off from the surface, and it is static.

Material setting

Select 4 bhkNiTriStripsShape block. Double-click on the Value of the Material entry (currently HAV_MAT_STONE). You get a drop-down list of available materials. Choose the material from the list, or enter the appropriate number which can be found here. This setting controls the hit sound, step sound, and arrow penetrability of the surface.





Collision properties

Select the 5 bhkRigidBodyT block. Interesting properties are marked with red dots on the picture. A list of all available properties is here

Most important properties:

  • The layer settings control the mesh color in CS, wheather the activator icon shows up when the player is close enough, wheather it behaves like a harvestable object like plants (no collision, but the activator icon shows up).
  • Motion System, Unknown Byte 1 and 2, Quality Type controls wheather the object is static or mobile.

Compare these properties to other NIFs, and change them accordingly.


--Entim 17:44, 18 September 2006 (EDT)