Common Problems With Meshes
From GECK
This page lists problems meshes can suffer from and reasons that they happen. Note that individual causes listed are not always bad in and of themselves.
Problems
- General Performance Issues
- Description: In general it's rare a single NIF will cause performance issues, most of the time optimization problems stack with many other factors during play.
- Potential Causes:
- Many strips or shapes with the same properties and effects that are not merged.
- A single strip / shape that is physically big compared to the player with many triangles (All triangles in a strip are rendered if even a small fraction of the strip is on camera). In cases like this it can be good to split some geometry into another strip for more effective culling. In general split geometry sparingly and opt to merge in most cases.
- Geometry blocks containing certain blocks like Stencil and Alpha properties when not needed.
- High vertex counts in general.
- Geometry block bounds that are too big. Can be fixed by tweaking the "Radius" and "Center" settings by hand or by reexporting geometry from a modeling program like Blender or 3ds Max which will auto generate correct bound values.
- NumStrips being greater than 1. Typically a result of a bad Blender export, greatly increases draw call count.
- Performance Issues With Collision
- Description: Most performance issues with collision usually involve movables and in general are not as much of a problem with statics.
- Potential Causes:
- High triangle counts: In general only a concern for collision with physics enabled. With convex type collision make sure triangle count is kept low and in general avoid using MOPP collision and favor convex and primitives as much as possible, if higher detail is needed on the movable favor using "listshapes" which can contain multiple convex and primitive shapes.
- Low penetration depth value: If the penetration depth setting on the bhkRigidBody is very low this effects how hard the engine will try to prevent penetration (Increased effect depending on "Quality Type"), additionally extremely low values can cause odd behavior when objects interact.
- Motion Quality: The "Motion Quality" set on the bhkRigidBody effects how aggressively the engine tries to prevent this object from penetrating.
- Broken / Distorted Lighting
- Potential Causes:
- Incorrect Tangents: Tangents that are not properly updated can cause distorted or black lighting, use the "Update All Tangent Spaces" spell in nifskope or use SNIFFs "Update Tangents" action to correctly generate tangents.
- Degenerate Normals: The mesh has degenerate normals caused by adjacent UVs overlapping in the same UV tile, this is fixed by moving the overlapping UV islands to another tile in the UV editor.
- Bad Smoothing: Meshes without smoothing or with poorly done smoothing can have distorted lighting in-game if the smoothing doesn't reflect the desired "sharpness". Use Blender to mark edges as sharp or use Max and apply smoothing groups.
- Single Pass shader flags: The mesh has geometry that has one of the "Single Pass" shader flags enabled which will cause broken lighting when more then 3 lights hit.
- Alpha Blending: Geometry block contains an alpha property with "Blending" enabled which forces single pass.
- Invisible Mesh
- Potential Causes:
- Material property with Maximum Alpha: A geometry block has a Material property with Alpha set to 0 which is the maximum alpha value.
- Flipped faces: Meshes with flipped faces can give the illusion of being invisible when they otherwise look normal in a 3D editor.
- Small bounds: Geometry block has bounds that are too small and thus culls when it shouldn't (controlled by the "Radius" and "Center" settings in nifskope)
- Wrong NiAVObject flags: Flags like "Hidden" are set or flags are set on the wrong nodes. See: NIF NiAVObject Flags for more info.
- Wrong CollisionObject target: In rare cases a CollisionObject that has the wrong target node can cause parts or all of the NIF to turn invisible in-game.
- Actors Being Unable To Navigate The Environment Properly
- Potential Causes:
- BSBound is too large: A BSBound on the actors skeleton being too large can cause actors to not be able to path through narrow gaps that they otherwise visually look like they should fit through.
- Bad collision: If the collision on the NIF is too big / not properly aligned it can prevent actors from pathing properly.
- Holes Or Cracks Where It's Possible See Through The Mesh
- Potential Causes:
- Improper face alignment: Using various snapping features in modeling programs when moving faces / verts can prevent these sorts of issues.
- Alpha Property: A geometry block in the mesh has an alpha prop which is making certain parts of the texture transparent that it shouldn't be.
- Missing Texture
- Potential Causes:
- Incorrect file path: A BSShaderTextureSet block has a incorrect filepath set or the texture itself was stored in the wrong location.
- Textures pathed without the textures\ prefix will render in Nifskope but not ingame
- Shader flag: A geometry block in the mesh has the "Multiple Textures" shader flag set.
- Stretched / Distorted Texture
- Potential Causes:
- Stretched UVs: the geometry has deformed UVs. Can be fixed with programs like Blender and 3dsMax or nifskope.
- Wrong Texture Clamp Mode: UVs with coordinates outside of 0 to 1.0 (the starting grid cell in the UV editor) need a texture wrap mode of "WRAP" for the correct axis. When in doubt just use WRAP_S_WRAP_T for everything.
- A Texture Set is applied to the wrong geometry block.
- Missing / Intangible Collision
- Potential Causes:
- No collision shape: The NIF doesn't have any bhkCollisionObject or a bhkRigidBody is missing a collision shape.
- Wrong layer type: A bhkRigidBody is using a wrong Collision layer type which depending on the type can allow different types of objects to pass through.
- No Target Specified: Having no target or wrong target node set (should be the NiNode the block is nested in) on a bhkCollisionObject can have collision that at best doesn't function and at worst, crashes the game.
- MOPP not updated: When MOPP type collision is created or edited, it needs a MOPP code update which can be done with SNIFF 1.4 or old versions of Nifskope.
- Transforms: In some rare instances transforms on the collision geometry or on a NiNode the collision is nested in can cause MOPP code updates to give you intangible collision. In most cases keep your transforms baked into the mesh itself.
- Animated Collision: Collision synced to animations will be intangible without the "USE_VEL" flag set on the CollisionObject.
- Impact Decals Not Applying
- Description: For various different reasons impact decals such as those left by firearms in the form of bullet holes will not apply to the visuals in game.
- Potential Causes:
- Geometry block is a NiTriShape: NiTriShapes do not support impact decals, instead NiTriStrips must be used.
- Collision object is nested deeper then then the actual geometry blocks you want decals on.
- Transforms: In rare cases unapplied transforms can make a geometry block unable to receive impact decals unless applied first.
- "No Decals" is set: The "No Decals" flag is set in NIF NiAVObject Flags.
- Wrong layer type: Some Collision layer types do not allow decals to spawn such as INVISIBLE WALL.
- Armor Not Being Removed on Unequip
- Description: Parts of, if not the entire armor remains on the player or an NPC even after being unequipped or outright removed from their inventory.
- Potential Causes:
- Bones in the NIF are indexed before the geometry. To fix, reorder the NIF structure so that the geometry comes before the bones.