Project

General

Profile

Bug #4301

Optimizer breaks LOD nodes

Added by Lord Berandas 3 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Rendering
Target version:
Start date:
01/20/2018
% Done:

100%

Reproducibility:
Always
Operating system:
Other
Severity:
Normal

Description

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.

use

placeatPC "furn_de_basket_01" 1 0 0
command to spawn the object, I recommend observing it in empty cell with tcl and twf commands.

furn_basket_01.nif - Replacement mesh with LoDs (61.3 KB) Lord Berandas, 01/20/2018 03:39 PM

Preview.png View - what a mess (4.83 MB) Lord Berandas, 01/29/2018 12:45 AM

Data Files.rar - ex_common_plat replacement set (61.8 KB) Lord Berandas, 01/29/2018 04:56 PM

openmw.osgt - Ex_common_plat_Cent (31.1 KB) Lord Berandas, 01/29/2018 05:51 PM

Associated revisions

Revision 25a6a675 (diff)
Added by scrawl . 3 months ago

Fix the optimizer messing up LOD node's children (Fixes #4301)

History

#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.

#4 Updated by Lord Berandas 3 months ago

Here is the illustration picture.

#6 Updated by Lord Berandas 3 months ago

Running it with "OPENMW_OPTIMIZE=OFF" didn't change anything.
I am attaching those MOAR meshes from the image.

#7 Updated by scrawl . 3 months ago

Just to clarify, you set the variable 'OPENMW_OPTIMIZE' to 'OFF', right?

I'll try the meshes in a bit.

#8 Updated by scrawl . 3 months ago

For future reports, it might be very helpful to have a screenshot from NifSkope and the output of 'ShowSceneGraph' with the object selected (in OpenMW). I'll look into updating bug reporting instructions.

#9 Updated by Lord Berandas 3 months ago

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:

OPENMW_OPTIMIZE=OFF openmw

I suppose for cmd.exe you need something like:

set OPENMW_OPTIMIZE=OFF
openmw.exe

#11 Updated by scrawl . 3 months ago

  • 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.

#12 Updated by Alexei Dobrohotov 3 months ago

  • Status changed from New to Closed
  • Assignee set to scrawl .
  • Target version set to openmw-0.44
  • % Done changed from 0 to 100

#13 Updated by Lord Berandas 3 months ago

You're right about the doubled TriShapes, they need to be fixed, thanks for pointing that out, also thanks for the fix. ;-)

Also available in: Atom PDF