Support NISortAdjustNode - subsort mode
NiSortAdjustNode can be used to control the local render order of meshes in a NIF file, according to 'node order'.
So in a nif, one makes NiSortAdjustNode as the parent node, and arrange the meshes/particles in the wanted render order.
Without it, meshes/particles with close origin coordinates would start flickering, as game always tries to render the closest objects first when camera view is changed. For ’effects nifs’, having multiple meshes/particles with close coordinates is unavoidable. So with NiSortAdjustNode it is not only possible to fix the flickering, but to actually ’plan’ the render order, make the effect work reliable, also achieve interesting things so its really a savior.
NiSortAdjustNode have following ’Sorting Mode’ options: SortingMode_Inherit, SortingMode_OFF, SortingMode_Subsort
In a previous closed issue they are described here: #6600 (closed)
As i understand SortingMode_Subsort should serve the purpose described above. However in mge-xe it didn't work (also for me it also didn't work in Openmw, see below)
In Mge-xe recently Hrnchamd solved this by adding a new ’Sorting Mode’ flag ’64’, so with it, NiSortAdjustNode does exactly what is needed.
mge-xe
Here is a test nif working in mge-xe to observe:
https://youtu.be/KVhfy6KwAHY - Its 6 separate meshes under NiSortAdjustNode with a proper node order, according to the wanted render order.
https://youtu.be/KVhfy6KwAHY?t=120 At 02:00 i disabled the NiSortAdjustNode to demonstrate the ’flickering’ which would happen without it.
The NIF setting looks just like this, really easy to handle in Nifskope: https://i.imgur.com/RWC6P5h.png
To open NIF with NiSortAdjustNode in Nifskope, G7’s nif.xml is required https://gist.github.com/Greatness7/82c736571fdc49ea6241e22c05719253
openmw
I wonder if it would be possible to make the same in OpenMW. So main object would be that same .nif works same in both engines.
I’ve made the same test NIF to see if it can work in OpenMW https://drive.google.com/file/d/1uzFXn3ibjKyfI5D8BnZsbcNys0fxM8a5/view?usp=sharing (if you enable .esp, it’ll spawn this crystal on balmora square, and balmora mages guild)
In this NIF i used ’SortingMode_Subsort’, but it doesn’t work as planned, as flickering still happens, and render order isn’t mathching node order. I wonder if i used the intended settings?
https://youtu.be/LRxg4vFNT7c - Here recorded the NIF in OpenMW (newest dev) So what would be ideal if this Nif worked like in the mge-xe recording.
(Parts of the nif also has NiStencilProperty to ’mask out(partly hide)’ the background glow mesh with the crystal's mesh. Now in OpenMW NiStencilProperty does something strange: renders the mesh before everything else. As this is separate issue, i’ll try to report this in the proper thread)