Interlaced Rendering Progress (Patreon)
Content
Interlaced rendering was implemented in these parts of the renderer:
BSP models:
- Rigid surfaces
- Liquid surfaces
- Sky surfaces
- Flatcolor surfaces
- Depth surfaces
MDL models
SPR sprites
Particles
Only these parts are left to do:
Screen buffer:
- Underwater warping
- Fog
- Copying to the video memory
2D GUI:
- 2D rasterizer
- Draw_fill
- Menu background colorization
Right now, the performance gain is over 50%. When interlacing is implemented on the screen buffer operations, it should go up some more.
So far, the interlacing was implemented in a way where all frames are rasterized into even lines; alternating the lines between frames to fill the whole screen only requires 1 line of code, but I'm not doing that yet because I've found a bug.
The interlacing of SPR sprites, MDL models and the procedural particles is working perfectly, but the interlacing of BSP surfaces is drawing randomly into the wrong lines. The wrong lines are drawn on a per-polygon basis, and each BSP polygon gets buggy or not according to the camera angles and position.
This not only causes the correct lines to lag (because they're being skipped), but it also causes the wrong lines to have ghosting artifacts (because they're being drawn on when they shouldn't). It also makes it impossible for the framebuffer interlacing to copy the correct data to the video memory, so there's no point in implementing framebuffer interlacing yet.
This weird BSP rendering bug is likely the cause of many random crashes in the engine due to drawing outside of the screen, so I hope that fixing it will make the engine more robust. Now that the interlacing allows me to test it, I'll dig into the BSP renderer to figure out what's causing it.
Once this bug is fixed, the rest of the interlacing implementation will be quick to finish.