Optimizer breaks LOD nodes
As probably most of you don't know, Morrowind had actually functional LoD system, sadly it was never used...and that's where MOAR was supposed to come.
Changing LoD variant is handled by the NiLoDNode node in the corresponding nif file. While this works fine in MW, the LoDs are not changed in the OpenMW. (it recognizes the LoD object in the F3 summary though)
Either the LoD distance values are off, or the engine is not using them at all.
You can test this by replacing the "furn_basket_01.nif" in your meshes folder and observing the mesh change in vanilla and OpenMW.
placeatPC "furn_de_basket_01" 1 0 0command to spawn the object, I recommend observing it in empty cell with tcl and twf commands.
#1 Updated by Lord Berandas 3 months ago
Okay, so I tried with another set of meshes with LoDs. In this case it seems the engine is actually switching the LoD variants, but only some of the materials are visible on the mesh (per LoD variant). All the triangles related to other materials are simply not rendered.
Collsiion meshes are working okay in all LoD levels.
#2 Updated by Alexei Dobrohotov 3 months ago
- Subject changed from OpenMW is not handling NiLoDNode distance values corectly or does not handle LoDs at all to OpenMW does not handle NiLODNode correctly
- Category set to NIF format
OpenMW does handle NiLODNode since 0.38.0, see #3008.
All the triangles related to other materials are simply not rendered.
Please clarify this part. "Materials" what?
#3 Updated by Lord Berandas 3 months ago
Each object is usually composed of several materials (each can use one texture), wood/wood rings/iron etc.
It seems that each LoD level uses only one material per object, so the rest of the object is not being rendered.
I cannot post a screenshot right now, but an example would be:
You have a door mesh, composed of wood, iron that surrounds it and a silver door handle.
In LoD 0 it renders only the door handle, when you get further, it renders only wooden parts in LoD 1 and even further you can see only iron parts in LoD 2.
I suspect an optimizer bug, can you try this? https://wiki.openmw.org/index.php?title=Bug_Reporting_Guidelines#Turn_off_optimization
#9 Updated by Lord Berandas 3 months ago
- File openmw.osgt added
Just to clarify, does "run OpenMW with the OPENMW_OPTIMIZE=OFF environment variable" mean to run openmw.exe with OPENMW_OPTIMIZE=OFF parameter?
What exactly would you like to see at the NifSkope screenshot? Node structure, or anything else?
Attaching the osgt file of one of the meshes.
#10 Updated by Andrei Kortunov 3 months ago
does "run OpenMW with the OPENMW_OPTIMIZE=OFF environment variable" mean to run openmw.exe with OPENMW_OPTIMIZE=OFF parameter?
No, it means set the environment variable and run the game.
Example for running OpenMW on Linux via console:
I suppose for cmd.exe you need something like:
set OPENMW_OPTIMIZE=OFF openmw.exe
- Subject changed from OpenMW does not handle NiLODNode correctly to Optimizer breaks LOD nodes
- Category changed from NIF format to Rendering
I looked at the furn_basket_01.nif and noticed two issues.
The first is the missing meshes, which fixed itself with OPENMW_OPTIMIZE=OFF. So my theory we have an optimizer bug was right. It's fixed in the latest commit.
Second, the actual LOD meshes are each present twice in the file, once under the LOD node and once above it. I think this file is broken and you have to remove meshes from the child list of the first node, or else they are going to be always rendered regardless of the active LOD. I don't know if vanilla would do exactly that, but anyway the file can be considered ambigious if not to say broken.