Oblivion/Creating New Hair Meshes
This tutorial is intended as an starter aid to those wanting to model Oblivion hair meshes. It does not claim any expertise - I have mostly worked with two existing hair meshes - cropped (style07), and Mohican (ElfMohawk). It relied on key info provided by BetterBodies forum moders (particularly Corwyn).
Basic hair mesh generation
- It may be possible to use existing 220.127.116.11. meshes exported by Blender. However they lack critical data :
- NiStringExtraData - a reference to an insertion point "Bip01 Head"
- Tangent Space data
- Vertex coloring data (not supported by the OBJ format, Blender, or fully by Nifskope)
- NiTexturingProperty - its not clear to me what this is for cause all the switches are off
- I used existing hair meshes. The choice of mesh can be important (later on).
- Create your hair mesh (I used theirs as starters). To create a Bald mesh just dump a small rendered cube inside the original mesh, and delete it (maybe you could get away with no mesh at all). Export as a OBJ file.
- Load the Bethesda hair NIF into Nifskope and import your OBJ file. Save under a new file name.
- Your mesh should then be picked up by TES. It will render, but not change color or shape.
- If you want your hair to change shape, you must provide (renamed) egm and tri files. These contain hair animation data. Naturally the results of the shape change can look like a punks tea party, if they work at all.
- If you want the hair to change color you must activate vertex coloring; and that's when the trouble starts.
- It appears that only one mesh/texture can be imported from the OBJ file. Any other meshes in the file will be merged into one. Of cause, this may be a flaw in my OBJ exporter - I don't know.
- You can put in other items other than hair. However given the restriction on submeshes/extra textures, and the lack of bone support (I found that my particular addon bits did not move with correcly with changes in head geometry) this is an NPC only option (I've only tried this in the TES, not in the game). It was better in Morrowind - so much for me doing spectacles for my Player.
- Setup in TES - add the mesh to the hair style list options (Make it playable), and then add the style to the race menu options.
- Run the game, activate console, type in ShowRaceMenu, select the hair mesh, exit to main chargen "Do you want to be a...?" screen, activate save/load screen, save game, reload game, and use the new haircut.
How to color the hair workarounds
Hair coloring depends on the use of (up to) 4 (implied) texture maps AND vertex coloring. Vertex coloring is a way of coloring a mesh without a texture by interpolating between vertices. The cropped mesh uses what may be default settings - 255 for each node. The mohawk mesh is a complex folded mesh that uses various color settings - possibly for special effect.
Blender dose not support the vertex color array needed. Yes it has a vertex coloring facility, but it don't work here - either cause the OBJ format don't use it, or cause the NIF importer/exporter don't. My tests suggest both. That's why you have to chose the correct Bethesda hair mesh NIF to alter.
- Import your OBJ into the NIF
- Activate vertex coloring - its a flag in the trishape block at the end of the NIF.
- Save your NIF - and get a warning message and a totally corrupt NIF
- The problem is that the number of nodes in the mesh must equal the number of entries in the original (unchanged) vertex array. You will have to either cut out vertices, or add a dummy mesh large enough to supply the extra vertices - NifSkope and the game don't seem to care where they come from, or that there is more than one mesh in the hair (extra materials could be another matter)
- Re-save the new NIF.
- If you cannot save the NIF correctly (warning message by NifSkope about invalid array size), it is cause the NIF has degraded (I presume that there has been info loss somewhere and it has become corrupt). Load in the original Bethesda NIF and reload the OBJ , reset the color flag, and try again. It will then save ok (well it does for me).
- Having done that your mesh should display in the game ok, if it uses the mohawk (gray.dds) texture. If it uses the cropped texture you could be in big trouble.
- The cropped (short.dds) texture complex contains gaps and transparencies that can show up in the mesh - badly - what shows up differs between (my editor), TES, and the Game. Increasing mesh density along the X axis (may have) removed the problem from my original mesh (I needed a mesh 50% thinner than my original). Trying to remove the problem from the original was pointless - I even duplicated the mesh, shrank it inside the original - no effect, even when the texture was rotated 180 - so it looks like meshes inside meshes are not rendered.
- The solution was to use the gray.dds map (repositioned), and apply a 90% transparency - the AlphaProperty transparency flags are already pre set in the NIF (and to more than the mere basic 237 needed), so just alter the alpha value. Its not as good as the correct texturing, but adequate. Try 75% transparency for very dense (rendered) textures. Ambient lighting conditions also have an effect.