--- title: 'The path to StreamFX 0.8.0' category: Blog tags: ['StreamFX'] ---

##

##

##

##

##

##

##

##

##

    Ensuring that Content Creators get a Crash-free StreamFX experience was a challenge. It took two years to get here, and now the plugin itself is likely more stable than OBS Studio itself. And with StreamFX 0.8.0 Alpha 1 (pre-release, not production ready) being available right now, everyone can enjoy it. But let's talk about what the past was, and what caused things to go wrong.

    Where It Went Wrong

    In the early days StreamFX had very few features, which was enough for the time. The first version was relatively stable as it only dealt with very basic libOBS calls that can't really go wrong. Even after adding Blur and Shape Mask to the existing 3D Transform and Displacement Mapping effects, things still looked fine.

    And here is where it starts going downhill (or uphill if you think that is harder). At the time I deluded myself into thinking that nobody else was really using it, but reality was very different.

    Bugs Bugs Bugs

    The first wave of bugs was freezes, crashing, scene corruption, and general nonsense. I tried to work around it by wrapping large parts of the "gs" part of libOBS into wrapper classes to automatically handle lifetime.

    And for the most part it actually worked. Version 0.3.0 had improved performance and a much lower crash rate. Even though some of the problems were because of a lack of documentation on the libOBS side.  As an example, up until 21.x there was no way to directly flush a vertex or index buffer with non-libOBS owned memory - and this fact wasn't documented.

    But things were looking good, better than before. I still had new features to implement, but how bad can it really get?

    A New Feature Appeared

    A random thought passed my mind: "What if you could have the same source, but one has different filters on it?"

    That is how Source Mirror came to life, the current second most used part of StreamFX right after 3D Transform. It allows you to create a copy of a Source at near zero cost and add a completely different set of filters to it. Something that required complex Scene setups before was now possible with just a single Source.

    Many users switched to it after seeing the potential, and it became a hit. So much that new bugs appeared every week, and the 0.4 release was followed by a 0.4.1 release, which was followed by a 0.4.2 release. That was two years ago in 2017, and the beginning of the downhill ride, or uphill battle.

    One-Year Long Patch Cycle

    While at the time I had work at a company which I shall not name, I also dealt with the AMD Encoder, and dealt with StreamFX. I tried my hand at adding Custom Shaders to StreamFX, which ended up very barebone and broken. But it was the first proof that this can actually be done - and at the time a completely new thing.

    This was released as 0.4.3 Preview 1 exclusively to Patrons (support my Projects and become a Patron today at Patreon) at the time. Some people liked the new Custom Shaders, some didn't, and others just ignored it. And later - after many fixes - 0.5.0 Preview 1 was released, which added support for Audio Mirroring to Source Mirror, allowing you to add audio effects to each copy.

    And then I vanished from the face of earth for about half a year. I had hit a huge burnout, nothing was fun anymore, and I was seriously depressed. In short, it was the worst time of my life (so far), and it caused me to lose my job at the time.

    When I finally recovered, it was around late September. I was refreshed, and got things done quickly, and dealt with lots of self-created issues.

    Commence Operation Cleanup

    Within a single month, I had accumulated more than 3000 lines of changes, all fixes or refactoring a design, even adding workarounds for shortcomings of the libOBS library (many of which still exist today). Blur got much faster, Signed Distance Field Shadows were added and Scene Mirroring was finally supported through a workaround for libOBS.

    The result of that was released as 0.5.0 Preview 2, again exclusively to Patrons at the time. It had been a full year since the last mostly stable build, and this one was released the day before christmas. It was a Christmas present like no other.

    And It Became Stable

    Shortly after Christmas passed, I returned to coding. Bugs needed fixing, new features had to be implemented. In total it took around a full month, but the result was worth it and released as 0.5.0 Preview 3. While I had to remove Custom Shaders, hundreds of fixes and changes made it in and it also brought MipMapping to 3D Transform, which is still mostly the same code today.

    And just one month after that, 0.5 was released - the next mostly stable version that was not a pre-release. It wasn't completely bug free, but it was getting there, with the remaining bugs were fixed in 0.5.1 and 0.5.2. And even more in 0.6, 0.6.1, 0.6.2 and 0.6.3 - which also added the ultra low impact Dual Filtering Gaussian Blur approximation.

    I had a new idea, and I was pretty sure that the last released built was  stable. And with my list of bugs to fix nearing the empty point, I  finally could focus on adding new features again. While adding Glow and  Outline to Signed Distance Field Effects was one of the features, it  wasn't the primary feature for the next version.

    If (!system.running()) system.change();

    That feature was actually Dynamic Mask, a simple filter that allows for very complex effects, with no limits to your creativity. It allowed you to mask any source using any other source or scene, adjusting the mask value per-channel - something that up to that point was impossible. Even the earliest implementation of it basically verified its reason to exist.

    When 0.7 released, I was not prepared for the creativity people had. At the time I was not fully aware of what I had just released into the world, but now I know that it can even be used as an alternative to Color Key and Chroma Key, which are both very awful in OBS Studio. But now I had no more features to implement, and no more bugs I knew how to fix.

    By pure chance, a Content Creator complained to me about how awful the Color Correction and LUT system in OBS Studio is. And at the time I was toying around with DaVinci Resolve. A new idea sparked: A Color Grading filter that takes after professional video editing software, and allows for a live preview.

    This filter released in 0.7.1 as experimental, and has pretty much replaced every single Color Correction and LUT I had used up until that point. It was just that good to be able to see your changes live while editing them, not just after exporting. Just compare the two screenshots below to see the power this filter has.

    With Color Grading

    Without Color Grading

    Where We Are Now

    And yet, 0.7.1 ended up as one of the most broken version of StreamFX to date. This actually carried over from 0.7 itself, but the addition of new things in 0.7.1 only made it worse. Crashes were happening left and right, scene collections got magically corrupted, and it was just in general not a good time.

    My initial attempts at fixing these bugs didn't go too great, but they were working attempts. With 0.7.2 Beta most things returned to working, but other things broke - especially because once again there is broken behavior in libOBS. Despite my best intentions, people were being forced back onto 0.7.1, and I had to fix things.

    That was the beginning of 0.8 Alpha 1, the most stable StreamFX release to date. Only half of the total commits between 0.7.2 to 0.8 Alpha 1 were actual fixes, but the fixes were really effective. The code was refactored without ensuring that things don't break temporarily, and in the end it worked out for the better.

    And not only that, with 0.8 Alpha 1 the biggest creative feature Custom Shaders came back from the dead in a brand new design. While it is still incomplete, the new implementation is much more flexible and already has more features than all previous implementations. In addition, Color Grade is now feature complete and stable too.

    It is an exciting time, and most importantly a time for a super stable StreamFX with all the features expected of it.

    Final Words

    The ride until now was bumpy, but it seems that things are finally going better. Crashes have mostly been resolved, rendering issues are getting less and less, and I'm running out of features to implement. The last and final feature that 0.8.0 will have is Custom Shader sources, filters and transitions, which opens up a whole lot of new creative options - all of which I'm looking forward to.

    And with that, I'm signing off.

    - Xaymar out.