Logged in as Guest | Group "Guests" | RSS
Tuesday, 07/07/2020, 18:33

Home | My profile

Total online: 1
Guests: 1
Users: 0

Merged-Mesh Nifs

A merged-mesh nif is a nif which contains multiple meshes that have been merged together into a single mesh.

The 2 main reasons I use merged-mesh nifs are:
1) Texture changing. All meshes in a merged-mesh can only use one texture from one BSLightingShaderProperty, so
instead of having to change every mesh individually, either in NifScope of in the CK using Texture Sets, you now
only need change 1 and the entire merged-mesh will use that texture.
2) Processing Power. When the game loads an object it has to check the propertoes of every mesh in a nif,
textures, collision type, animation, physics (including mass, inertia, gravity, friction, etc.), and it has to
check these properties EVERY FRAME!!! SO having a merged mesh can reduce the load on your system resources quite
a bit!
As an example, the straight wooden beams I use in Gypsy Eyes Caravan for the main frame, originally there were
140 of them, and every single one had to have it's properties checked every frame it was on-screen, now with the
beams merged just 1 mesh needs to be checked reducing the needed checking by 139 times!!!

When you've used the same object in a nif multiple times, when you have a lot of meshes which use the same texture
or when it will make positioning in NifScope easier as when merged each item's "center" is reset to the current
location with co-ords that then get set to 0, 0, 0 as a lot of meshes can be waaaay off-center which makes
positioning a real pain sometimes.
Also for creating new collision meshes (see Collision Tutorials).

If your meshes use different textures, if you feel you may want to change individual textures at some point, if
you've manipulated a meshes textures in any way using Scale or Offset in BSLightingShaderProperty.

Ok, so in this tutorial I'm going to merge the apple meshes I added to the bowl in Multi-Mesh Nifs into a single mesh.

As you can see, at the moment each apple is an individual mesh.

Begin by right-clicking the BSFadeNode at the root of the object tree and select Node/Attach Node.

Now in the new list tha appears find and select NiNode.

With your new NiNode in place right-click the first of your objects to be merged (in this case an apple) in the
object tree and select Block/Copy Branch (or just hit CNTRL+C).

Now move to the NiNode, right-click and select Block/Paste Branch (or CNTRL+V).

This will now give you a duplicate object in the same location as the original, don't worry, we'll be deleting
the originals at the end but for now leave them in place.

Repeat this process with the remaining objects untill all have been duplicated in the NiNode.

Now we need to remove the "extras". open each objects branch on the tree, right-click any item which ISN'T
NiTriShapeData and select Block/Remove Branch,
The most common will be BSLightingShaderProperty's and NiTriAlpha's.

Repeat with the remaining objects.

Now to merge!
Selct and right-click the NiNode container and select Optimize/Combine Shapes.

Your bunch of objects should now be one single mesh!

Time to put the textures back!
Open the branch of any of the original objects, right-click BSLightingShaderProperty and select Block/Copy Branch.

And then paste it into the new merged mesh, select and right-click the merged meshes NiTriShape and select
Block/Paste Branch.
Repeat this process with any other parts the mesh requires, NiTriAlphas etc.

Your new merged-mesh is complete, time to remove the originals.
Right-click each in turn and select Block/Remove Branch.

All done!
You now have a merged-mesh nif to use in your mods!

NOTE: Sometimes objects may not merge, check the NiTriShapeData of each and you'll probably find that the one that
doesn't merge has a different setting in HasVertexColors.
As you can see below the apples do but the bowl doesn't, simply change one or the other so they match (usually
changing to No is best) and try merging again, it should now work.


Copyright MyCorp © 2020