So in order to get palette flashes working, I think the shader needs to be reworked into two parts:
The texture shader should output palette indexes rather than colors
A post-processing shader will transform the indexes into colors, with a swappable palette.
Some considerations:
Should the texture shader use a colormap? effects like the invulnerability might require the post-processing shader to use the colormap instead. If so, then the texture shader should output the lightlevel in another channel. (Red: palette index, Green: brightness)
Truecolor textures will need to use a LUT to convert the color into a palette index, meaning truecolor textures will no longer render as truecolor.
An option to use a truecolor shader instead of paletted?
So in order to get palette flashes working, I think the shader needs to be reworked into two parts:
Some considerations:
Should the texture shader use a colormap? effects like the invulnerability might require the post-processing shader to use the colormap instead. If so, then the texture shader should output the lightlevel in another channel. (Red: palette index, Green: brightness)
Truecolor textures will need to use a LUT to convert the color into a palette index, meaning truecolor textures will no longer render as truecolor.
An option to use a truecolor shader instead of paletted?