Senin, 02 September 2013

Skyrim modding Tips

Skyrim Modding Tips &Trick

sources : Niftools forum
Texture and UV

Author: ttl269
U and V are X and Y coordinates on source texture mapped to range from 0.0 to 1.0. So U=0, V=0 is top left corner, U=1 V=0 is top right corner, U=1, V=1 is bottom right corner, U=0.5 V=0.5 is in middle of source texture.
UV Scale defines ratio between pixel in source texture and pixel in texture mapped on model. If scale U and V are both set to 1.0 it means, that one pixel from source texture is mapped on one pixel on model - most common setting. Setting U scale to 2.0 and V to 1.0 means, that in U direction two pixels from source texture are mapped on one pixel on model, i.e. two copies of source texture are mapped in U direction on model - you will see two textures on same area of model, but of course texture will be in U direction stretched to fit same area.
U represents X direction, V represents Y direction on 2D texture.
UV scale set to other values than 1.0, 1.0 has nearly no use on normal models. It is more likely used for animated textures effects. But setting UV scale to 0.0, 0.0 causes that no pixels from source texture are mapped on model.

Texture Clamp Mode determines whether the pixels out of source texture area (out of range 0.0-1.0) are mapped on model or not - i.e. if source texture pixels is repeated in desired direction when U or V coordinate get out of range from 0.0-1.0. CLAMP means no, WRAP means yes. Most common setting is WRAP_S WRAP_T.
S represents U direction, i.e. X direction, T represents V direction, i.e. Y direction…

Skyrim Specific

- in UV Scale set both X and Y to 1.0, otherwise you will not see textures
- TextureClampMode set to WRAP_S WRAP_T
- Alpha set to 1.0, If you have 0.01 - it is nearly invisible. It may be produced when NIF exported from 3Dsmax?

set "BS Num UV Sets" to 4097, you also have to fill right values in Tangents and Bitangents arrays - right click over NiTriShape and select "Mesh -> Update Tangent Space". Otherwise normal map texture will not be used in right way.

Forr static object. If yes:
1) NiStringExtraData block with WeaponBack value attached to root BSFadeNode? Delete it - it is used only for nifs of weapon objects.
2) If your nif will not be used for LoadScreen Object in CK, delete BSInvMarker.
3) BSXFlags - it is important for game. Common static objects usually have only BSXFlags in Extra Data of root node and have set its Integer Data to 130 in case the nif has collision.

originally posted by ttl269

Vertex Colors
If you don't use them, i. e. in NiTriShapeData is "Has Vertex Colors" set to "no", you have to unset all Shader flags related to vertex colors in BSLightingShaderProperty, i.e. in Shader Flags 1 there must be unset flag "SLSF1_Vertex_Alpha" and in Shader Flags 2 must be unset flag "SLSF2_Vertex_Colors".

If you use them (in NiTriShapeData is "Has Vertex Colors" set to "yes" and Vertex Colors array is filled with values), you have to set flag "SLSF2_Vertex_Colors". In case you use vertex colors only for coloring of selected vertices, it is enough. If you want to use also alpha components of vertex colors to get per vertice transparency, you also have to set flag "SLSF1_Vertex_Alpha".

Tangents and Bitangents
They should be used on every mesh using normal map except body parts (parts using skin tint). To set Tangents and Bitangents:
- make sure NiTriShapeData of your mesh has "Has Normals" set to "yes" and that "Normals" array is filled properly, i.e. it don't contains zeroes - if yes, right-click over "NiTriShapeData" and select "Mesh -> Face Normals"
- make sure that value in "BS Num UV Sets" in "NiTriShapeData" is set to 4097, if not, set it to that value.
- right-click over "NiTriShape" (not NiTriShapeData) and select "Mesh -> Update Tangents Space"

If you have a lot of NiTriShapes which need to get/update Tangents and Bitangents in their NiTriShapeData, set "BS Num UV Sets" in all NiTriShapeData blocks to 4097 and then go to to menu "Spells" and select "Batch -> Update All Tangent Spaces".

Body parts (parts with human skin) which uses "Skyrim Shader Type" of "Skin Tint" don't use neither Tangents and Bitangents nor Normals - look at some vanilla nif with armor or clothing where part of human skin is visible (for example meshes\clothes\blacksmith\f\torso_1.nif) . In its NiTriShapeData you find "Has Normals" set to "no", "BS Num UV Sets" set to 1 and "Has Vertex Colors" set to "no". In "BSLightingShaderProperty" there is "Skyrim Shader Type" set to "Skin Tint" and in "Shader Flags1" you find set flags "SLSF1_Model_Space_Normals" and "SLSF1_FaceGen_RGB_Tint".

Clarification - skin tint and model space normals (at least doing testing here) are not mutually dependent. You can have one w/o the other (which I do for some "fake" body parts). The ones that don't use normals/tangents are meshes that have SLSF1_Model_Space_Normals. Conversely, you can have meshes use tangent normals and also use skin tints/SSS/SLSF1_FaceGen_RGB_Tint -- these do require BS NUM 4097 and all that. However, if you want seamless everything, best to stick with one or the other.

Other tips and tricks:

- BSDismember for skyrim meshes is OPTIONAL, but good practice to have. If using BSDismember though, make sure it's set to a part referenced by your ArmorAddon, otherwise your mesh simply won't show.
- Copy BSLightingShaderProperties by copying from another nif file and pasting on the root node. Do NOT paste on top of a NiTriShape, won't work (even though it looks like it works)
- Certain meshes have a BSBehaviorGraphExtraData. This is useful for things like custom animated tails. To use it, copy it to your desired mesh, making sure that your mesh is rigged already w/ tail bones. Then change the TXT to Name=BGED and Behaviour Graph File=AuxBones\Tail\TailProject.hkx

Main Nav