The challenge of revising the renderer

Something has been bothering me about the notion of revising the renderer by starting with certain superficial bits like lens flares and 3D models. While this approach is feasible, there is a considerable amount of friction when trying to interface with the old rendering code. The old code makes certain assumptions and behaves in inefficent ways; it is difficult not to let the new GL2 rendering code be overly affected by these inoptimal traits.

This is what essentially halted progress of the new lens flare rendering code. There was no sensible way to interface the new flares with the old light source information. The so called “lumobjs”, as the old renderer calls them, are recreated every frame (!) and therefore the new flare renderer’s more efficient design had trouble linking to this information. The new flares assume that light sources persist while the map is loaded, across frames, so that the parameters of the flares can be smoothly animated and updated and there is a persistent way to identify each source.

Fortunately, recently a sizable obstacle has been cleared: one can now have any amount of private, renderer-related data for each mobj in an efficient and elegant manner. This will allow refactoring lumobjs to be persistent and owned by their sources, so that the new flares can work with them. Still, this is rather a hefty amount of code to refactor.

When it comes to 3D models, there is again several assumptions being made about things like how the object is positioned, what angles it is rotated at, and what kind of special blending modes should be applied (to name a few). Some of this is specified using DED definitions, some is hardcoded. It is a considerable amount of work to reconsider and redesign all these details in the context of persistent GL2 models that use skeletal animation.

Considering the near time frame (1.15 release), it won’t be possible to write a perfect, fully-featured model renderer due to the limitations imposed by the rest of the code. Still, it will be much easier to adapt the new GL2 code to further changes made in the future. One just has to ensure that any new code is decoupled from the old renderer’s way of doing things.

I’m hoping in 1.15 there will be enough functionality for people to start creating 3D models in new formats (and packages) even if they aren’t as completely integrated with the engine and game world as one could hope.