OpenMW: Transitioning From Ogre3D to OpenSceneGraph

openmw-0.33

The OpenMW team posted a pair of updates over the Valentine’s Day weekend. The first of these took a look at their use of the Ogre3D engine in light of the release of Ogre 2.x, and highlighted some issues that the team were struggling to overcome:

Some of the issues have to do with the way OpenMW “stitches together” the bodyparts of people to make them a working whole. As you might know, people in Morrowind consist of a torso, a head, legs and arms. They also have to be able to hold items, which is another thing to stitch to the model. Since this bit isn’t implemented in Ogre 2 yet, this part will break functionality.

Scrawl’s latest post on his website talks more about issues such as these, so if you are technically inclined and want to know more, definitely give it your eyeballs.

Scrawl’s real thoughts on Ogre3D are better captured in this post, however:

So, I’ve been asked about my thoughts on the Ogre 2.1 release, and the implications for OpenMW. Here they are.

OpenGL3 requirement

The 2.1 branch has dropped all support for OpenGL2. OpenMW was never meant to run on hardware that originally ran Morrowind – still, dropping GL2 support seems a bit extreme at this time. For example, the open source Mesa drivers haven’t caught up to that point yet (at least not on Ubuntu 14.04, and thus one of my dev machines). Admittedly this may become more or less irrelevant a few years down the line.

Diverging branches

Development is currently split across 3 different unstable branches (1.10, 2.0 and 2.1). 2.0 and 2.1 are lagging behind the 1.10 branch with 500+ unmerged fixes. This makes contribution unattractive to say the least.

New material system

This is the feature I was looking forward to the most, but now I’m a little disappointed. The shader macro system is very basic and does not appear to support setting a uniform to a material property or to a scene parameter. Most of the work is done by the C++ implementation which is tightly coupled to a specific shader.

The default Physically Based Shading materials are nice but obviously not usable with Morrowind’s lighting system. Coding custom materials is possible but not without intimate knowledge of the underlying AZDO backend. The default PBS material C++ implementation comes at a whopping 2000+ lines and makes use of a “command buffer” and “vao manager” that we can obviously not expect Ogre users to be familiar with.

This also goes against the principle of making the shaders as user-modifiable as possible, one of my main goals with the rendering backend in OpenMW.

The general issue is trading flexibility and fast prototyping for hardcore performance. Overall, not something I am comfortable using, so I started looking for alternatives.

And indeed, an alternative to Ogre was found in OpenSceneGraph:

In light of these issues, we’ve looked around for alternatives and found the OpenSceneGraph, which appears a perfect fit for the features required by Morrowind and OpenMW, while also delivering high performance. We’ve carefully evaluated all needed features and verified that they can be found in the OSG source code, or can be easily added by a plugin. A detailed roadmap for the port will be posted in the near future, and updated regularly so you can follow along the progress.

One notable difference is OpenSceneGraph supporting OpenGL only. Ogre3D having inbuilt support for OpenGL and DirectX may be considered one of its strong points. In an ideal world this would result in greater choice for the user while requiring no extra effort from the OpenMW team. Unfortunately this is not quite true; writing shaders does not work in a render system agnostic way. In addition to that, we have found some OpenMW bugs only manifesting themselves when the Direct3D backend is used. So we are in fact happy about this change, as we do not have the manpower to maintain support for two different rendering systems, and most of our developers are working on Linux and thus unable to test the Direct3D renderer anyway.

In that same article, you can find a “preemptive FAQ” that discusses the timeline for the transition, the fate of Ogre-based OpenMW releases to date, and more.

There has been no word yet from the Titans of Ether as to whether/how this shift will impact Ultima IX: Redemption, but hopefully the effect will be minimal.