V2 Bloom


The VectorStorm version 2 project has reached a milestone today:  the “glow” shader has been reimplemented to work with it.

In the original VectorStorm library, this “bloom” effect was implemented using about 200 lines of raw OpenGL code.  It was ugly code, it was difficult to follow, it was difficult to maintain.

In the new V2 library, the “bloom” effect is now implemented using VectorStorm’s built-in rendering commands — the same commands used to render models and UI.  Instead of 200 lines of explicit OpenGL code, it now uses just 60 lines of VectorStorm rendering instructions.  Which means that it’s vastly easier to read and maintain, and also that it ought to simply work if someday I was to port VectorStorm V2 to DirectX or some other rendering API.

You wouldn’t believe how long I’ve been dreading trying to make this work.  In the end, it only took a single day.

There’s still a bit of work to be done, of course.  There are big issues around how render targets are allocated and managed which I need to clear up.  And I need to make some difficult choices regarding how to manage custom shaders in V2.  And the default rendering pipeline a game gets if it doesn’t request anything special doesn’t include the bloom shader yet.  But getting bloom to work at all in the new V2 codebase was the big tricky part.  And it’s handled, now — everything else is just accounting.