Skip to content

Draw order does not match Morrowind.exe

Vaguely related to #6443 (closed), #7305, and maybe #3366.

HR_Main features a dormer that uses stencil magic to render in front of the roof it's attached to. A separate window static has been placed inside the dormer:

image

In OpenMW the window mesh isn't visible:

image

@glassmancody.info got the window to render by enabling blending on it, concluding that the issue is likely a draw order difference:

If I force the window to draw later by enable blending on it it renders correctly -- so yeah likely draw order
Right now we render these things after the opaque bin, it might be different in morrowind.exe
e.g. stencil enabled nifs are rendered first

@hemaris-tr noted that in Morrowind.exe draw order is affected by the way references are ordered in a cell. PTR developers have to take this into account when working with NiStencilProperty meshes, occasionally removing and readding objects so they end up in the correct order.