Rework Palette Rendering #86

Merged
alufolie91 merged 24 commits from newpalshader into Saturn-Next 2024-01-18 16:28:19 +01:00
alufolie91 commented 2024-01-11 10:26:54 +01:00 (Migrated from github.com)

This completely reworks the palette renderer to use parts from Hannu Hanhi´s amazing work on https://git.do.srb2.org/STJr/SRB2/-/merge_requests/1516

This brings a few benefits, aswell as making the code easier and more understandable

  • Improved colour accuracy (colours are more in line with the actual software renderer and alot less overblown)
  • Improved Brightness accuracy (the brightness on some maps was quite off in alot of cases)
  • Improved Perfomance (in some cases the newer code performed around 40fps better for me than the old one)
  • Fixed Gamma slider issues (the old one didnt properly apply changes from the gamma slider until the next map load)
  • Also ported over NearestPaletteColor, which is completly backwards compatible to NearestColor but can be supplied with any given palette instead of just pLocalPalette
  • OpenGLs own gamma correction was removed, due to being in huge conflict with this (however the gammastuff branch might resolve this, as this adds back seperate gamma for colors, that can even be applied in software renderer https://github.com/Indev450/SRB2Kart-Saturn/tree/gammastuff)

However, some things from the old code remains, primarily the shader handling and the postprocess step
This is due to the Shader code/handling in srb2 works alot differently than in Kart which would require substantial rework
The postprocess shader is still applied in the DrawScreenFinalTexture directly as opposed to being applied to its own seperate screen texture, which may lead to some brightness issues in some cases, as screen fades or transparent surfaces
(maybe someone can figure this out, ive commented out the related code in i_video.c)

This should be tested thoroughly, but from my testing everything seemed to work really well

New Code
kart0451

Old Code
kart0452

Software Renderer
kart0433

This completely reworks the palette renderer to use parts from Hannu Hanhi´s amazing work on https://git.do.srb2.org/STJr/SRB2/-/merge_requests/1516 This brings a few benefits, aswell as making the code easier and more understandable - Improved colour accuracy (colours are more in line with the actual software renderer and alot less overblown) - Improved Brightness accuracy (the brightness on some maps was quite off in alot of cases) - Improved Perfomance (in some cases the newer code performed around 40fps better for me than the old one) - Fixed Gamma slider issues (the old one didnt properly apply changes from the gamma slider until the next map load) - Also ported over NearestPaletteColor, which is completly backwards compatible to NearestColor but can be supplied with any given palette instead of just pLocalPalette - OpenGLs own gamma correction was removed, due to being in huge conflict with this (however the gammastuff branch might resolve this, as this adds back seperate gamma for colors, that can even be applied in software renderer https://github.com/Indev450/SRB2Kart-Saturn/tree/gammastuff) However, some things from the old code remains, primarily the shader handling and the postprocess step This is due to the Shader code/handling in srb2 works alot differently than in Kart which would require substantial rework The postprocess shader is still applied in the DrawScreenFinalTexture directly as opposed to being applied to its own seperate screen texture, which may lead to some brightness issues in some cases, as screen fades or transparent surfaces (maybe someone can figure this out, ive commented out the related code in i_video.c) This should be tested thoroughly, but from my testing everything seemed to work really well New Code ![kart0451](https://github.com/Indev450/SRB2Kart-Saturn/assets/136046486/ccd0b558-5d44-448f-99c0-f2e7da5313b7) Old Code ![kart0452](https://github.com/Indev450/SRB2Kart-Saturn/assets/136046486/7c926cff-11f5-4cab-aa44-026c98017d60) Software Renderer ![kart0433](https://github.com/Indev450/SRB2Kart-Saturn/assets/136046486/1ec72302-76f4-40b3-8324-08427bf00f08)
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: saturn/SRB2Kart-Saturn#86