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.
- subpixel triangles: if triangles in your FOV become subpixel with distance this will make the GPU work harder.
- 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.
- Motion Quality: The "Quality Type" set on the bhkRigidBody, effects how aggressively the engine tries to prevent this object from penetrating.
- 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.
- 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. It is sometimes required to use blending for the desired look but in general it's best to avoid using it when possible.
- Stencil: The mesh has a stencil property for double sided faces which leads to inconsistent lighting. To fix remove the stencil prop and add duplicate flipped faces in Max or Blender instead.
- Glowmap + Parallax: Using a combo of a Glowmap with a "Parallax Shader Index 15" shader flag set can cause lighting to flicker oddly, this issue can be hard to spot as it only happens at specific camera angles. If you wish to fix, either use an emissive without a glowmap when Parallax is also used or remove parallax from the Strip/Shape you are working with.
- Glowing Mesh
- Description: Parts of or the entire mesh are glowing when they shouldn't be.
- Potential Causes:
- Material Emittance: A material property has an "Emissive Color" defined that is not black, set all RGB values to 0 for full black to disable emittance.
- Material Gloss: A material property with very low gloss values below 10 (Or set to 0) can cause the appearance of glowing, on the opposite end very high values can also give a "shiny" look to the mesh, when in doubt use a value of 10 which is the default value. Note that the proper gloss value varies wildly depending on normal map composition and specular brightness as well as the look you are aiming for.
- Shader Flag: The "External_Emittance" shader flag is set which will cause glowing at different times of the day.
- Bad normal map: the normal map for the Strip/Shape is either set to be too bright or was improperly made. To reduce brightness, reduce the opacity of the normal map which will reduce bright spots from lights.
- 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). Can be fixed by reexporting the mesh in Blender or 3DS Max and they will automatically regenerate bounds.
- Wrong NiAVObject flags: Flags like "Hidden" are set or flags are set on the wrong nodes. See: NIF NiAVObject Flags for more info.
- Scaling: A scale of 0 (or a very tiny value) on the geometry or the NiNode the geometry is nested in will make the mesh invisible.
- 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.
- 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 as well as welding geometry together.
- 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. To fix, either adjust the UVs so that the UVs do not cover areas of the texture that have transparent pixels or remove the alpha property itself if the Strips/Shapes you are working with are intended to be fully opaque.
- 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 3ds Max 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.
- 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 a NIF in the environment is too big / not properly aligned it can prevent actors from pathing properly.
- Wrong Layer Type: If the object is a movable object, and one that is particularly large or heavy, actors can get caught on it when it gets moved to another position due to it blocking the navmesh, the NIF should then be setup to support navcuts by setting the correct Collision layer on a bhkRigidBody, additionally the baseform of the object needs the "obstacle" flag checked.
- 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.