Difference between revisions of "User talk:DavidJCobb/Tutorials/Editing NIFs"
Jump to navigation
Jump to search
imported>DavidJCobb |
imported>DavidJCobb |
||
(7 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
* Vanilla Orc hairs for women are modeled ''terribly.'' You'd expect the non-hairline NIF to contain the bulk of the hair and the hairline NIF to just have the parts that need to blend; in practice, ''both'' NIFs contain the bulk of the hair, and the hairline NIFs' bulk actually covers the non-hairline meshes. This wouldn't be a problem except that while most of the hairline meshes are therefore opaque, vertex alpha blending is enabled for the whole meshes, and that blending prevents EffectShaders from affecting them. I'm working on a fix to go in my "tweaks" mod, wherein I edit the hairline NIFs and split the meshes. | * Vanilla Orc hairs for women are modeled ''terribly.'' You'd expect the non-hairline NIF to contain the bulk of the hair and the hairline NIF to just have the parts that need to blend; in practice, ''both'' NIFs contain the bulk of the hair, and the hairline NIFs' bulk actually covers the non-hairline meshes. This wouldn't be a problem except that while most of the hairline meshes are therefore opaque, vertex alpha blending is enabled for the whole meshes, and that blending prevents EffectShaders from affecting them. I'm working on a fix to go in my "tweaks" mod, wherein I edit the hairline NIFs and split the meshes. | ||
** Hair tutorials claim that changing the "flags" on the NiAlphaProperty will fix EffectShaders. This is misleading. The "flags" aren't a bitmask; they're actually the entire set of alpha settings. Moreover, it's really only ''one'' flag inside of that data that has an effect, and it's the flag to force one-bit alpha with a threshold (as opposed to a smooth blend, which is what the textures are designed for). So no. That's not a fix. | ** Hair tutorials claim that changing the "flags" on the NiAlphaProperty will fix EffectShaders. This is misleading. The "flags" aren't a bitmask; they're actually the entire set of alpha settings. Moreover, it's really only ''one'' flag inside of that data that has an effect, and it's the flag to force one-bit alpha with a threshold (as opposed to a smooth blend, which is what the textures are designed for). So no. That's not a fix. | ||
*** Testing also indicates that shaders don't ''necessarily'' apply reliably even if that flag is set. | |||
* Test case is female Orc hair 05 since that's what I was using on my character at the time. | * Test case is female Orc hair 05 since that's what I was using on my character at the time. | ||
Line 9: | Line 10: | ||
* Update the NIFs. | * Update the NIFs. | ||
** Import hair NIF into Blender 2.7x and make edits there, since Blender 2.49b is an abomination unto God and its continued | ** Import hair NIF into Blender 2.7x and make edits there, since Blender 2.49b is an abomination unto God and its continued necessity is a tragedy. | ||
** Make a "legacy save" that Blender 2.49b will be able to open. | ** Make a "legacy save" that Blender 2.49b will be able to open. | ||
** Open the legacy file in Blender 2.49b and make minor fixes to prep for export. | ** Open the legacy file in Blender 2.49b and make minor fixes to prep for export. | ||
Line 36: | Line 37: | ||
* Use NifUtilsSuite's NifConvert to upgrade the NIF for Skyrim. | * Use NifUtilsSuite's NifConvert to upgrade the NIF for Skyrim. | ||
* Fix tree (Blender export generates a useless parent node), node flags, textures, etc. in NifSkope | * Fix tree (Blender export generates a useless parent node), node flags, textures, etc. in NifSkope | ||
** Rotations on the skeleton head node will likely be wrong | ** Rotations on the skeleton head node will likely be wrong; copy the original values from your prior NIF | ||
** NiSkinData bone lists will have bad transforms on the head bone; set translation to zero and rotation to the inverse of the skeleton node's rotation | ** NiSkinData bone lists will have bad transforms on the head bone; set translation to zero and rotation to the inverse of the skeleton node's rotation | ||
*** The bounding spheres will need to be corrected as well. The values from your original NIF will make a good starting point, and may not even need further editing. Older versions of NifSkope should preview each node's bounding sphere as a grey circle when the Bone List entry is selected (but not when its contained data is selected): the sphere should encompass all vertices associated with that node when you rotate the camera and swing it around. Newer versions of NifSkope have changed how the bounding data is handled (it is now two separate fields, "Bounding Sphere Offset" and "Bounding Sphere Radius," rather than a proper data structure), which prevents it from being easily previewed in the editor. | |||
** As with the Blender 2.49b-only process, Fallout 3 bone names are in use. Change them back to SBP_31_HAIR. | ** As with the Blender 2.49b-only process, Fallout 3 bone names are in use. Change them back to SBP_31_HAIR. | ||
** Vertex colors may be exported incorrectly (converted to all white), and this is significant in that it will cause you to lose your alpha even with a NiAlphaProperty. I'm not sure how to address this at this time. | ** Vertex colors may (only sometimes??) be exported incorrectly (converted to all white), and this is significant in that it will cause you to lose your alpha even with a NiAlphaProperty. I'm not sure how to address this at this time other than by manually rebuilding the vertex colors in NifSkope. | ||
*** If you don't need vertex ''colors'', i.e. all vertices have #FFFFFF RGB, then perhaps you could tell Blender to treat the VertexAlpha color-set as the primary one; at least then it'd be ''easier'' to fix things up in NifSkope, because you wouldn't have to cross-reference across files with differing vertices. (The modern NIF scripts import RGBA colors as two RGB sets, to compensate for Blender's missing support for RGBA. The second set functions as an alpha mask. Don't ask me why Blender supports multiple sets of vertex colors but not RGBA for any of them.) | |||
Further research needed: | ''Further research needed:'' | ||
* Skyrim only seems to support one NiTriShape per head-part NIF. Is there a way to get it to use multiple? | * Skyrim only seems to support one NiTriShape per head-part NIF. Is there a way to get it to use multiple? | ||
** For my use case, there may be a workaround: move the "body" portion of the hairline mesh into the non-hairline NIF (i.e. edit them in Blender 2.7x to combine the two into a single NiTriShape), such that the hairline NIF contains only the "edge" geometry. | |||
'''Updating the TRIs:''' | '''Updating the TRIs:''' | ||
Line 50: | Line 54: | ||
** The Nexus has a TRI importer/exporter, but it's only for the version of Blender that hates you and everything you love. | ** The Nexus has a TRI importer/exporter, but it's only for the version of Blender that hates you and everything you love. | ||
** The Lascivious Slab has an updated importer/exporter for version 2.63+, but you'll need to make an account there to download it from the forums. | ** The Lascivious Slab has an updated importer/exporter for version 2.63+, but you'll need to make an account there to download it from the forums. | ||
*** This version works for Blender 2.78 without generating any errors, at least. Exported TRIs don't appear to behave correctly in-game, even though you can re-import them into Blender and they'll work perfectly. Something's wrong. | |||
** The Nexus wiki has a clumsy moment-to-moment [http://wiki.tesnexus.com/index.php/Working_with_Skyrim_head_TRIs tutorial for editing TRIs]; it fails to give a high-level overview of what you're actually ''doing'' or ''why'', but it's possible to glean some information from it. | ** The Nexus wiki has a clumsy moment-to-moment [http://wiki.tesnexus.com/index.php/Working_with_Skyrim_head_TRIs tutorial for editing TRIs]; it fails to give a high-level overview of what you're actually ''doing'' or ''why'', but it's possible to glean some information from it. | ||
*** It looks like the process involves using a utility to convert a TRI to a text file, fixing the converted file in Notepad++, importing that into Blender, making edits, exporting back to text, and then converting to a new TRI. | *** It looks like the process involves using a utility to convert a TRI to a text file, fixing the converted file in Notepad++, importing that into Blender, making edits, exporting back to text, and then converting to a new TRI. | ||
*** The tutorial itself seems to be concerned with modifying head NIFs (as if creating or tweaking races) and then adjusting existing headparts to fit your changes, whereas my concern is more with fixing blends on edited headparts. | *** The tutorial itself seems to be concerned with modifying head NIFs (as if creating or tweaking races) and then adjusting existing headparts to fit your changes, whereas my concern is more with fixing blends on edited headparts. | ||
* | ** TRIs are edited in Blender as [https://docs.blender.org/manual/ko/dev/animation/shape_keys/introduction.html shape keys]. | ||
* | |||
Latest revision as of 21:27, 15 April 2019
Editing Skyrim hairs[edit source]
Use case:
- Vanilla Orc hairs for women are modeled terribly. You'd expect the non-hairline NIF to contain the bulk of the hair and the hairline NIF to just have the parts that need to blend; in practice, both NIFs contain the bulk of the hair, and the hairline NIFs' bulk actually covers the non-hairline meshes. This wouldn't be a problem except that while most of the hairline meshes are therefore opaque, vertex alpha blending is enabled for the whole meshes, and that blending prevents EffectShaders from affecting them. I'm working on a fix to go in my "tweaks" mod, wherein I edit the hairline NIFs and split the meshes.
- Hair tutorials claim that changing the "flags" on the NiAlphaProperty will fix EffectShaders. This is misleading. The "flags" aren't a bitmask; they're actually the entire set of alpha settings. Moreover, it's really only one flag inside of that data that has an effect, and it's the flag to force one-bit alpha with a threshold (as opposed to a smooth blend, which is what the textures are designed for). So no. That's not a fix.
- Testing also indicates that shaders don't necessarily apply reliably even if that flag is set.
- Hair tutorials claim that changing the "flags" on the NiAlphaProperty will fix EffectShaders. This is misleading. The "flags" aren't a bitmask; they're actually the entire set of alpha settings. Moreover, it's really only one flag inside of that data that has an effect, and it's the flag to force one-bit alpha with a threshold (as opposed to a smooth blend, which is what the textures are designed for). So no. That's not a fix.
- Test case is female Orc hair 05 since that's what I was using on my character at the time.
Basic process:
- Update the NIFs.
- Import hair NIF into Blender 2.7x and make edits there, since Blender 2.49b is an abomination unto God and its continued necessity is a tragedy.
- Make a "legacy save" that Blender 2.49b will be able to open.
- Open the legacy file in Blender 2.49b and make minor fixes to prep for export.
- Export as a Fallout 3 NIF, and use NifUtilsSuite to upgrade to a Skyrim NIF.
- Make (numerous!) repairs in NifSkope.
- Update the TRI files.
- ?????
Updating the NIFs:
- Import hair mesh into Blender 2.7x and make edits as needed. Latest NIF scripts can import skinned meshes and preserve weights, but cannot export them (even unmodified).
- I have a Cycles shader that can blend and apply vertex and texture alpha together. Should post it when I get a chance.
- If you're working with multiple meshes, make sure they're all descendants of the same armature-object.
- When you look at the outline panel in Blender, you'll see two entries in the tree that have little person icons. One is the armature-object and the other is its armature-data. Modern Blender clearly differentiates objects from data by showing the former with orange icons and the latter in grey. Old Blender has no visual distinction, because it hates us all.
- If you must duplicate a mesh-object in Blender, then... well, just select that object. If you're unfamiliar with all this crap, your instinct will be to just select everything, but if you just select the meshes and dupe them, the dupes will be created as siblings within the same armature-object.
- Save two copies of your BLEND file for safety's sake. The latter must have the "legacy" flag ticked, so that Blender 2.49b can load it; that is the file we'll be working with from here on out.
- Legacy save doesn't work properly: the length limit for object names is shorter in Blender 2.49b, and the legacy save doesn't account for this. Blender 2.49b is also a complete idiot when it comes to renaming objects (references to them aren't updated and still look for old names), so no, it's not worth the effort to fix it on that end. Good rule of thumb: before making the legacy save, nothing should have a name longer than 12 characters.
- Open legacy BLEND in Blender 2.49b and make minor fixes:
- Uncheck the "Envelope" flag on the Armature. Blender 2.7x doesn't handle the flag properly: it always sets it when making the legacy save, and the old NIF scripts can't work with that.
- Flip to the Text Editor view and delete the "BoneExNames" data block that the new NIF scripts created on import; it's incorrectly computed, and therefore it's trash that will break your export.
- Export as a Fallout 3 NIF with these settings.
- Scale Correction: 1.0 [defaults to 10, which we don't want; we already had the right scale on import]
- Export Geometry Only.
- Flatten Skin.
- Export Skin Partition.
- Use NifUtilsSuite's NifConvert to upgrade the NIF for Skyrim.
- Fix tree (Blender export generates a useless parent node), node flags, textures, etc. in NifSkope
- Rotations on the skeleton head node will likely be wrong; copy the original values from your prior NIF
- NiSkinData bone lists will have bad transforms on the head bone; set translation to zero and rotation to the inverse of the skeleton node's rotation
- The bounding spheres will need to be corrected as well. The values from your original NIF will make a good starting point, and may not even need further editing. Older versions of NifSkope should preview each node's bounding sphere as a grey circle when the Bone List entry is selected (but not when its contained data is selected): the sphere should encompass all vertices associated with that node when you rotate the camera and swing it around. Newer versions of NifSkope have changed how the bounding data is handled (it is now two separate fields, "Bounding Sphere Offset" and "Bounding Sphere Radius," rather than a proper data structure), which prevents it from being easily previewed in the editor.
- As with the Blender 2.49b-only process, Fallout 3 bone names are in use. Change them back to SBP_31_HAIR.
- Vertex colors may (only sometimes??) be exported incorrectly (converted to all white), and this is significant in that it will cause you to lose your alpha even with a NiAlphaProperty. I'm not sure how to address this at this time other than by manually rebuilding the vertex colors in NifSkope.
- If you don't need vertex colors, i.e. all vertices have #FFFFFF RGB, then perhaps you could tell Blender to treat the VertexAlpha color-set as the primary one; at least then it'd be easier to fix things up in NifSkope, because you wouldn't have to cross-reference across files with differing vertices. (The modern NIF scripts import RGBA colors as two RGB sets, to compensate for Blender's missing support for RGBA. The second set functions as an alpha mask. Don't ask me why Blender supports multiple sets of vertex colors but not RGBA for any of them.)
Further research needed:
- Skyrim only seems to support one NiTriShape per head-part NIF. Is there a way to get it to use multiple?
- For my use case, there may be a workaround: move the "body" portion of the hairline mesh into the non-hairline NIF (i.e. edit them in Blender 2.7x to combine the two into a single NiTriShape), such that the hairline NIF contains only the "edge" geometry.
Updating the TRIs:
- Research pending.
- The Nexus has a TRI importer/exporter, but it's only for the version of Blender that hates you and everything you love.
- The Lascivious Slab has an updated importer/exporter for version 2.63+, but you'll need to make an account there to download it from the forums.
- This version works for Blender 2.78 without generating any errors, at least. Exported TRIs don't appear to behave correctly in-game, even though you can re-import them into Blender and they'll work perfectly. Something's wrong.
- The Nexus wiki has a clumsy moment-to-moment tutorial for editing TRIs; it fails to give a high-level overview of what you're actually doing or why, but it's possible to glean some information from it.
- It looks like the process involves using a utility to convert a TRI to a text file, fixing the converted file in Notepad++, importing that into Blender, making edits, exporting back to text, and then converting to a new TRI.
- The tutorial itself seems to be concerned with modifying head NIFs (as if creating or tweaking races) and then adjusting existing headparts to fit your changes, whereas my concern is more with fixing blends on edited headparts.
- TRIs are edited in Blender as shape keys.