This brings over the blending mode system from SRB2 2.2, along with overhauling elements of the software renderer.
Many of these additions and changes are from toaster and sphere's Blentran pull request for base 2.2, which since has been merged in since 2.2.10.
EDIT: Some of these screenshots are from earlier versions of this, where the shadow object was left opaque due to lacking the AST_TRANSLUCENT blendmode. This has since been fixed:
General changes
The software renderer now has unique color look up tables, mainly used to find blendmode colors.
Related to the above: Gif recording now uses this new LUT system out of necessity.
OpenGL rendering has been slightly overhauled, now having support for blending modes.
HUD changes
V_DrawStretchyFixedPatch (and its hardware equvalent) can now render with blendmode flags.
The blendmode flags, marked with a B_ prefix, are B_ADD, B_SUBTRACT, B_REVERSESUBTRACT, and B_MODULATE
Unlike 2.2, blendmode flags are separated into their own field to prevent removing preexisting vflags. To call these in Lua, add the blendmode flags after the colormap field.
Currently, only the Lua HUD functions v.draw, v.drawScaled, and v.drawStretched support blendmodes.
Mobj changes
Objects now all have a blendmode variable. As with every Saturn-exclusive variable, this isnot netsynched!
Frame flags have been slightly overhauled, with the inclusion of FF_SEMIBRIGHT, FF_FULLDARK, and blendmode-related frame flags. The blending frame flags allow you to assign blending modes for certain objects easily.
The blending frame flags are: FF_ADD, FF_SUBTRACT, FF_REVERSESUBTRACT, and FF_MODULATE. Like in base 2.2, they can be combined with the translucency flags.
Linedefs and FOFs
Linedefs have an overhaul, now using a proper alpha value instead of relying on a relay of its special to accomplish the same result.
FOF blendmodes can be set by adding a 4th digit to any translucent FOF's translucency value (1 = Additive, 2 = Subtractive, 3 = Reverse-subtractive, 4 = Modulative).
Known issue
In software, certain color combinations can cause the LUTs to bug out and render as pure white pixels. I'm unaware of any fix to this issue.
This is immediately noticeable by using Additive rendering on a player with the Caribbean color, or using any blendmode in Masters Pack's Autumn Ring.
This issue is not present in OpenGL, even with paletted rendering (software on left, OpenGL paletted on right).
Test files:
The .zip contains both a test map for additive linedefs and FOFs, and a Lua file for testing blendmodes at different transparencies, saturn_blendmodetestfiles.zip
All of this was tested on a 64-bit Windows build, compiled with MSYS2. Tested on Software and on OpenGL with various options (models on/off, shaders on/off, palette rendering on/off). A simple test for communication with vanilla clients (loading the test map and hosting a local server) was performed, with no issues.
All changes made here used the Saturn branch (and not Saturn-Next) as a base.
This brings over the blending mode system from SRB2 2.2, along with overhauling elements of the software renderer.
Many of these additions and changes are from toaster and sphere's [Blentran pull request](https://git.do.srb2.org/STJr/SRB2/-/merge_requests/1656) for base 2.2, which since has been merged in since 2.2.10.
* EDIT: Some of these screenshots are from earlier versions of this, where the shadow object was left opaque due to lacking the ``AST_TRANSLUCENT`` blendmode. This has since been fixed:
* 




## General changes
* The software renderer now has unique color look up tables, mainly used to find blendmode colors.
* Related to the above: Gif recording now uses this new LUT system out of necessity.
* OpenGL rendering has been slightly overhauled, now having support for blending modes.
## HUD changes
* ``V_DrawStretchyFixedPatch`` (and its hardware equvalent) can now render with blendmode flags.
* The blendmode flags, marked with a ``B_`` prefix, are ``B_ADD``, ``B_SUBTRACT``, ``B_REVERSESUBTRACT``, and ``B_MODULATE``
* Unlike 2.2, blendmode flags are **separated into their own field** to prevent removing preexisting vflags. To call these in Lua, add the blendmode flags after the colormap field.
* Currently, only the Lua HUD functions ``v.draw``, ``v.drawScaled``, and ``v.drawStretched`` support blendmodes.
## Mobj changes
* Objects now all have a ``blendmode`` variable. As with every Saturn-exclusive variable, *this is* ***not netsynched!***
* Frame flags have been slightly overhauled, with the inclusion of ``FF_SEMIBRIGHT``, ``FF_FULLDARK``, and blendmode-related frame flags. The blending frame flags allow you to assign blending modes for certain objects easily.
* The blending frame flags are: ``FF_ADD``, ``FF_SUBTRACT``, ``FF_REVERSESUBTRACT``, and ``FF_MODULATE``. Like in base 2.2, they can be combined with the translucency flags.
## Linedefs and FOFs
* Linedefs have an overhaul, now using a proper alpha value instead of relying on a relay of its special to accomplish the same result.
* Linedefs and FOFs now use blendmodes.
* The corresponding linedef specials are [identical to base SRB2 2.2.10's](https://wiki.srb2.org/w/index.php?title=Translucent_wall&oldid=115610).
* FOF blendmodes can be set by adding a 4th digit to any translucent FOF's translucency value (1 = Additive, 2 = Subtractive, 3 = Reverse-subtractive, 4 = Modulative).
## Known issue
* In software, certain color combinations can cause the LUTs to bug out and render as pure white pixels. I'm unaware of any fix to this issue.
* This is immediately noticeable by using Additive rendering on a player with the Caribbean color, or using any blendmode in Masters Pack's Autumn Ring.
* This issue is not present in OpenGL, even with paletted rendering (software on left, OpenGL paletted on right).
 
## Test files:
The .zip contains both a test map for additive linedefs and FOFs, and a Lua file for testing blendmodes at different transparencies,
[saturn_blendmodetestfiles.zip](https://github.com/user-attachments/files/18640704/saturn_blendmodetestfiles.zip)
All of this was tested on a 64-bit Windows build, compiled with MSYS2. Tested on Software and on OpenGL with various options (models on/off, shaders on/off, palette rendering on/off). A simple test for communication with vanilla clients (loading the test map and hosting a local server) was performed, with no issues.
**All changes made here used the Saturn branch (and not Saturn-Next) as a base.**
Figured white pixel bug out!
Here, and in all other similar loops, condition should be either <= 0xFF of < 0x100, because otherwise it misses 1 last palette index every time (because 0xFF is 255, so it ignores it even though it is valid index)
Figured white pixel bug out!
Here, and in all other similar loops, condition should be either `<= 0xFF` of `< 0x100`, because otherwise it misses 1 last palette index every time (because 0xFF is 255, so it ignores it even though it is valid index)
wow, how didn't I catch that? ^^;
def seemed to do the trick, I'm not encountering the white pixel bug anymore
wow, how didn't I catch that? ^^;
def seemed to do the trick, I'm not encountering the white pixel bug anymore

Been testing this for a while now, everything so far seem to work well! c:
Took the liberty to merge this into the Testing branch aswell as adding blendmodes to a few effects, so this can be tested more thorougly
Been testing this for a while now, everything so far seem to work well! c:
Took the liberty to merge this into the Testing branch aswell as adding blendmodes to a few effects, so this can be tested more thorougly
ok for whatever reason github refused to show my comment here so let me requote it lel
Noticed this while compiling with clang, the flag assingment should be moved back to before the "V_WRAP" handling, otherwise those options get overwritten (and doing any operation on an unitialized value may lead to undefined behaviour)
ok for whatever reason github refused to show my comment here so let me requote it lel
> Noticed this while compiling with clang, the flag assingment should be moved back to before the "V_WRAP" handling, otherwise those options get overwritten (and doing any operation on an unitialized value may lead to undefined behaviour)
Ok, after some further testing i did notice an unusual performance regression on a few maps (mostly wandering falls) in opengl, after a bit of investigation i pinned it down to those https://github.com/Indev450/SRB2Kart-Saturn/commit/1e79d464b019817b8ec5805a6683247856fe96cd (HWR_SplitWall not using the blendmode flag was actually something i messed up a while ago oops)
would appreciate if this could be implemented into the pr c:
Ok, after some further testing i did notice an unusual performance regression on a few maps (mostly wandering falls) in opengl, after a bit of investigation i pinned it down to those https://github.com/Indev450/SRB2Kart-Saturn/commit/1e79d464b019817b8ec5805a6683247856fe96cd (HWR_SplitWall not using the blendmode flag was actually something i messed up a while ago oops)
would appreciate if this could be implemented into the pr c:
yeah everything looks good to me now c:
sorry again this took so long, the above comment sat here for 2 weeks until i noticed it wasnt even visible lol
yeah everything looks good to me now c:
sorry again this took so long, the above comment sat here for 2 weeks until i noticed it wasnt even visible lol
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
This brings over the blending mode system from SRB2 2.2, along with overhauling elements of the software renderer.
Many of these additions and changes are from toaster and sphere's Blentran pull request for base 2.2, which since has been merged in since 2.2.10.
AST_TRANSLUCENTblendmode. This has since been fixed:General changes
HUD changes
V_DrawStretchyFixedPatch(and its hardware equvalent) can now render with blendmode flags.B_prefix, areB_ADD,B_SUBTRACT,B_REVERSESUBTRACT, andB_MODULATEv.draw,v.drawScaled, andv.drawStretchedsupport blendmodes.Mobj changes
blendmodevariable. As with every Saturn-exclusive variable, this is not netsynched!FF_SEMIBRIGHT,FF_FULLDARK, and blendmode-related frame flags. The blending frame flags allow you to assign blending modes for certain objects easily.FF_ADD,FF_SUBTRACT,FF_REVERSESUBTRACT, andFF_MODULATE. Like in base 2.2, they can be combined with the translucency flags.Linedefs and FOFs
Known issue
Test files:
The .zip contains both a test map for additive linedefs and FOFs, and a Lua file for testing blendmodes at different transparencies,
saturn_blendmodetestfiles.zip
All of this was tested on a 64-bit Windows build, compiled with MSYS2. Tested on Software and on OpenGL with various options (models on/off, shaders on/off, palette rendering on/off). A simple test for communication with vanilla clients (loading the test map and hosting a local server) was performed, with no issues.
All changes made here used the Saturn branch (and not Saturn-Next) as a base.
ok this is frickin awesome, been wanting to have these since ages
thanks alot for this! c:
looking forward testing this
All looks good :3
Tried to see why white pixel bug happens but no idea either, but besides that from testing had no other issues
@@ -234,6 +235,189 @@ void R_InitTranslationTables(void)W_ReadLump(W_GetNumForName("TRANS70"), transtables+0x60000);Figured white pixel bug out!
Here, and in all other similar loops, condition should be either
<= 0xFFof< 0x100, because otherwise it misses 1 last palette index every time (because 0xFF is 255, so it ignores it even though it is valid index)@@ -234,6 +235,189 @@ void R_InitTranslationTables(void)W_ReadLump(W_GetNumForName("TRANS70"), transtables+0x60000);wow, how didn't I catch that? ^^;

def seemed to do the trick, I'm not encountering the white pixel bug anymore
Been testing this for a while now, everything so far seem to work well! c:
Took the liberty to merge this into the Testing branch aswell as adding blendmodes to a few effects, so this can be tested more thorougly
@@ -286,7 +287,11 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_tv[0].t = v[1].t = 0.0f;ok for whatever reason github refused to show my comment here so let me requote it lel
Ok, after some further testing i did notice an unusual performance regression on a few maps (mostly wandering falls) in opengl, after a bit of investigation i pinned it down to those https://github.com/Indev450/SRB2Kart-Saturn/commit/1e79d464b019817b8ec5805a6683247856fe96cd (HWR_SplitWall not using the blendmode flag was actually something i messed up a while ago oops)
would appreciate if this could be implemented into the pr c:
@@ -286,7 +287,11 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_tv[0].t = v[1].t = 0.0f;ah, good catch
hopefully these last few commits fix this and the performance issues mentioned
@@ -286,7 +287,11 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_tv[0].t = v[1].t = 0.0f;yeah everything looks good to me now c:
sorry again this took so long, the above comment sat here for 2 weeks until i noticed it wasnt even visible lol
For me this is good to merge now
Big thanks again for this c:
and sorry for the delay lul