Closed JNechaevsky closed 7 months ago
- TODO: Screen wiping disabled. It is not possible to use
XLATAB
neither for crossfading, nor for any kind of translucency. Wiping effect will require entirely different approach, probably via some SDL functions, like making a copy of existing texture and blending it with variable opacity level, depending on game tic or something. No idea how to proceed at the moment.
No need for low level functions. We know RGB pixel values for source and destination pixels and can blend them with each other.
- TODOs : Graphical startup with RAW patches working, but not sure it's an optimal way, since
pal_color[]
must be filled before graphical startup, and then filled again after generating colormaps.
No problem. ๐คท
No need for low level functions. We know RGB pixel values for source and destination pixels and can blend them with each other.
May I ask for small advice regarding usable function? At the moment I know only how to operate with / blend single colors, while this case with whole screen/texture is far more complicated.
No problem. ๐คท
I'm afraid we do have a problem here. Intro sequence was slightly broken in Crispy Strife 6.0, i.e. it's simply not appearing, probably because of RAW patches are supposed to use byte
, not pixel_t
type just like RAW screens. The problem is - turns out, I have fixed only half of this problem, so only last frame of last sequence now appears. Hmm.
May I ask for small advice regarding usable function? At the moment I know only how to operate with / blend single colors, while this case with whole screen/texture is far more complicated.
Sorry if I'm under-estimating things, but don't we just need something like I_BlendOver()
with a variable blend_alpha
?
Makes a huge sense, thank you. On paper, crossfading should be something like this when wiping routine is called. At least, as I can see this logics...
void F_CrossFade (void)
{
// Make a copy of existing texture, once.
pixel_t *dest = I_VideoBuffer[SCREENWIDTH * SCREENHEIGHT];
// Stop crossfading when value equals zero.
int opacity = 255;
do
{
if (--opacity == 0)
continue; // Stop when reached zero value.
I_BlendFade(dest, I_VideoBuffer[SCREENWIDTH * SCREENHEIGHT], opacity);
} while (oldgametic < gametic); // Must be framerate independent.
}
This seems to be working as cross-fading effect, we even don't need a new blending function:
Well, by "seems" I meaning that initial fading right after game start is working, but once it's done, the game soft-locks. This is exactly the same problem when XLATAB
is composed without necessary precision in paletted render, I've tried it couple of years ago. Something must be done with these lines, probably.
Anyways, crossfading effect in super slow motion, it's not that epic, but at least colors seems to be fine:
https://github.com/fabiangreffrath/crispy-doom/assets/21193394/408cffd2-0186-4cc9-b5ea-44f68653dffe
Almost done with crossfading effect. So, the problem with crossfade is described on DoomWiki, and it also affects TrueColor render. I don't see any ways to fix it in initial implementation, but after some experiments found that fix is pretty simple - an infinite loop happens here, when render "fails" to compare one screen data with another: https://github.com/fabiangreffrath/crispy-doom/blob/master/src/strife/f_wipe.c#L99.
A small trick can help escaping such loop, here's a small example just for show:
Ah yes, also this thing... I'm afraid I don't get it right, still not very good with memory handling, but this way it works.
I'll pull changes soon, but what makes me really sad - despite of working more or less okay, this crossfade looks a bit... Poor. It could be more nice and soft, but at least there is some result.
@fabiangreffrath, just FYI, a progress report. Crossfading effect is done and working, I was aiming for something decent, but got identical to vanilla instead, except with cleaner TrueColor colors. Not sure if it is possible to make animation smoother since animation is performed via game tics, which makes a strict limitation in duration itself. Any ways, even possible infinite loop problem is fixed for both paletted and TrueColor renders - it's not really needed in first one, until custom XLATAB
is used, but absolutely needed for TrueColor, since we comparing screen data between "old" and "new" screens.
Only one small but stinking problem remains: a startup sequence (animation of robot shooting to civilian). At the moment, it's showing just a black screen in paletted render (presumably, it was was broken even before TC code), and after some pushing, it's showing just a final frame in TrueColor render. Not sure how to properly proceed with both cases yet, TC obliviously requires pal_color
array to be set, and it is done right before animation, but still doesn't work for non-final frames. And there have to be two calls for R_InitPalColors()
, otherwise ingame pal_color
graphics will be all black. ๐
I don't want to leave it "as is" and try to push harder, but the game itself is now working just fine, though some extra testing is still needed.
Guess it's all done and ready for full review. Small testing map for checking translucency + translation effects: strife-test.zip (also contains Sigil piece for checking "invul" colormap effect).
Small remark: smooth crossfading is possible, and it looks much, much better. But I've bumped into problem of "the smoother fading is, the longer after-fading delay is happening". Something have to be done in wiping do
loop probably, but not sure what exactly... Video demonstration, note that I'm holding "turn right" which is happening only after this delay is gone:
https://github.com/fabiangreffrath/crispy-doom/assets/21193394/df20a61a-04a7-4c94-8a57-e567e17152b1
My greatest pleasure, thank you for accepting and help!
Would like to take a small speech in the end. Heretic TrueColor took 10 days, Hexen took about 7. Strife in general part took ~24 hours if not counting reviewing, polishing and experimenting. Unforeseen "break" knocked me out for many of days, but this is where phrase "we are not in rush" gorgeously comes in and fits perfectly. โ๏ธ๐
Startup sequence is also fixed for both renders, but let's not point a finger who slightly broke it while adding negative gamma-correction levels. ๐ถ
Kind thanks to @ceski-1 for massive efforts on Crispy Strife and especially for taking care of framerate-independent wipe effect and adding support for smooth diminished lighting - this is how TrueColor appears in all it's power! ๐ค
The only thing that makes me sad at this point is a not smooth, but at least vanilla-like and soft-lock safe crossfade effect. Once smooth effect was seen, it was nothing more like "whoah!... ๐ฎ", even if CPU is not very happy with such amount of computing. I will keep investigating, there have to be way.
Guess, first paragraph of FAQ needs small update now.
Guess, first paragraph of FAQ needs small update now.
Please feel free! There will be another surprise: https://github.com/fabiangreffrath/crispy-doom/pull/1196
Please feel free! There will be another surprise: https://github.com/fabiangreffrath/crispy-doom/pull/1196
๐คฉ Yeah! Will gladly do, in the evening or at least on weekend, but anyways, better will show it to you first, for small proof-reading.
Guess, it also deserves a small announcement on DoomWorld forum thread, along with small explanations that "true color is not about new graphical effects or dynamic lighting. It's about clean colors in vanilla render". Will you take a honor to make this speech?
๐คฉ Yeah! Will gladly do, in the evening or at least on weekend, but anyways, better will show it to you first, for small proof-reading.
Never mind, I think we will only have to remove the first sentence. ๐
Guess, it also deserves a small announcement on DoomWorld forum thread, along with small explanations that "true color is not about new graphical effects or dynamic lighting. It's about clean colors in vanilla render". Will you take a honor to make this speech?
I'd like to announce this as part of the next "official" release. People closely following the project will notice earliert anyway.
Never mind, I think we will only have to remove the first sentence. ๐
Done! โก๏ธ
I'd like to announce this as part of the next "official" release. People closely following the project will notice earliert anyway.
Ah, sure, whatever you say.
Small and brain-dead trick for smoother crossfading without post-effect delay:
But aside from terrible magic number operation with fade_counter
, it's still not good enough by making few last frames notably darker before crossfading ends. Turns out, I_BlendOver
receiving slightly incorrect amount
value (unlikely, simple printf
showing that they are correct), or this is because effect in general is happening not with opaque background screen, but with translucent as well. Or something like that.๐คฏ
Another notable thing is - if using I_BlendAdd
, controls are back imideatelly after "toxical" crossfading with fade_counter = 14
is done.
This is the final chapter of Crispy true color story, what else can be said? ๐ Just a few remarks and TODOs:
TODO: Screen wiping disabled. It is not possible to useXLATAB
neither for crossfading, nor for any kind of translucency. Wiping effect will require entirely different approach, probably via some SDL functions, like making a copy of existing texture and blending it with variable opacity level, depending on game tic or something. No idea how to proceed at the moment.TODOs : Graphical startup with RAW patches working, but not sure it's an optimal way, sincepal_color[]
must be filled before graphical startup, and then filled again after generating colormaps.Brightmaps working. Strife is usingCOLORMAP
for such trick, it was easy it replicate it by locking necessary colors on the first light level.Strife using two levels of translucency: 25% and 75% for column/segs drawing and only 75% for patch drawing. Kaiser's comment in r_segs.c helped a lot in the question of opacity values.And of course, small and not very colorful example of before and after: