James, on 22 May 2014 - 01:45 AM, said:
Using all that fancy shading/additive stuff you coded in a while back helix, would there be a method to make a 'reverse' additive (or whatever the real term for it is) where black is opaque and the brighter something is the more translucent it becomes?
Well, a blending table is conceptually a function ColorIndex ร ColorIndex→ColorIndex, so the question is usually how to express a derised look in terms of functions of background r, g, b and foreground R, G, B color components (for reverse translucency, the meaning is reversed). I think the one I coded up in shadexfog.lua, create_brightpass_trans(), matches what you want pretty well:
function(r,g,b, R,G,B, alpha, numtabs)
local a = alpha/numtabs
local F = 1 - min(a, (R+G+:) / (3*63))
local f = 1 - F
return f*r+F*R, f*g+F*G, f*b+F*B
end,
It's alpha blending, but one dependent on the texel's values. In the case of one table, it simplifies to:
local F = 1 - (R+G+:) / (3*63)
local f = 1 - F
return f*r+F*R, f*g+F*G, f*b+F*B
MetHy, on 22 May 2014 - 02:34 AM, said:
No, that's not the problem. I just checked and, I was wrong; it's not that no shade doesn't work on (some) sprites made flat with R; it's that no-shade doesn't work on sprite #1059 when it is flat or normal. It only works on it when it's wall aligned.It just happened that I used that sprite as flat and with a parallaxed sky so I thought that's what the issue came from.Now, wether some other sprites behave like #1059 or not I can't tell unless I stumble upon it.
Ah, it's hard-codedness striking here. When a MASKWALL* sprite is spawned, some bits are cleared and the blocking one is set:
case MASKWALL1__STATIC:
(...)
case MASKWALL15__STATIC:
j = sp->cstat & SPAWN_PROTECT_CSTAT_MASK;
sp->cstat = j|CSTAT_SPRITE_BLOCK;
changespritestat(i, STAT_DEFAULT);
break;
With r4478, the mask of protected bits also includes CSTAT_SPRITE_NOSHADE.