JNechaevsky / international-doom

Small, functional and simple source ports, created with help, efforts and bits of code from people around the world.
https://jnechaevsky.github.io/inter-doom/
GNU General Public License v2.0
30 stars 2 forks source link

Feature request (maybe): Fade animations #94

Closed kitchen-ace closed 7 months ago

kitchen-ace commented 9 months ago

In GlBoom+ there is a GL option called "fade animations" that fades animated textures and flats from one frame into another. AFAIK no other port supports this, and I really like the look of it.

With the inter-ports having truecolor support, it should be possible for this to happen and look nice, in theory.

I have no idea how hard this would be to actually do though, it might be way too much work to even consider since you can't use the GL implementation, and that's fine. Just thought I'd ask.

There's also the issue of swirling liquids; I guess swirling should take priority over fading.

JNechaevsky commented 9 months ago

At the moment, this is the only huge, and probably the one problem for implementing true color support for Crispy Strife. 🙂 I haven't investigated it yet, but it will needed to be done sooner or later. Using translucency table is not possible in true color, so approach should be different. Something like... Making a copy of current SDL texture and blitting it onto the screen while opacity value is reduced with game tics.

JNechaevsky commented 7 months ago

Something like this, but needs polishing.

https://github.com/JNechaevsky/international-doom/assets/21193394/bdbabeb7-a8a2-49c8-834c-032b58a00e43

JNechaevsky commented 7 months ago

@kitchen-ace, @Meerschweinmann, @NightFright2k19,

I'm thinking to add crossfade to Heretic and Hexen, it's pretty straightforward now.

https://github.com/JNechaevsky/international-doom/assets/21193394/c59986d7-8054-4c23-8c18-8c631197cb39

But how do you think, does Heretic and Hexen needs original "melting" effect from Doom? IMO, it really looks out of place. Not a problem to add it too, but... See yourselves:

https://github.com/JNechaevsky/international-doom/assets/21193394/854527cc-c59d-49c3-b87f-2b433c46ed16

Meerschweinmann commented 7 months ago

I like the crossfade-effect way more than the wipe effect. With Inter-ports ability to use truecolor a nice touch on top. And i am with you, the wipe-effect is a DOOM thing that was there since the 90s.

kitchen-ace commented 7 months ago

@Meerschweinmann

I like the crossfade-effect way more than the wipe effect. With Inter-ports ability to use truecolor a nice touch on top. And i am with you, the wipe-effect is a DOOM thing that was there since the 90s.

Agreed, crossfade looks really nice, melt looks unnecessarily Doom-like.

JNechaevsky commented 7 months ago

Thanks! I'll proceed with crossfade-only then.

NightFright2k19 commented 7 months ago

Since this doesn't contribute anything to gameplay, it's most definitely a trivial feature. But yeah, if it is to be implemented anyway, at least not with Doom melting effect. If you really need it - there's always GZDoom. Where literally anything goes.

JNechaevsky commented 7 months ago

Agreed completlely, thanks again! In terms of features, starting from Inter-Everything 7.0 I'm trying to carefully go with "Just because you can, doesn't mean you should" way. 🙂

JNechaevsky commented 7 months ago

Have to complain a bit.

I'll merge it soon so you check it out, but there will be complains from your sides, better I'll just unroll it.

JNechaevsky commented 7 months ago

P.S. In theory, this opens small potential for "burn" and something similar effects, there are couple of other blending functions. Ah yes, about flats fading - this should be doable technically, but might be not very trivial. The real problem here - any kind of translucency effects, and crossfading is also using it, is always expensive in TrueColor render. Yep, even drawing spectres is expensive. 👻 Better be careful, at least until render becomes fully hardware accelerated.

kitchen-ace commented 7 months ago

Ah yes, about flats fading - this should be doable technically, but might be not very trivial. The real problem here - any kind of translucency effects, and crossfading is also using it, is always expensive in TrueColor render. Yep, even drawing spectres is expensive.

Fair enough! I wonder if it could be optimized though? Since the translations with textures/flats are always predictable, perhaps they could be precomputed/cached in some way? Just speculating.

JNechaevsky commented 7 months ago

It should be possible indeed, and this is like a Holy Grail. 🙂 The problem is - in current implementation every pixel of graphics on every screen pixel is computed dynamically on single core of CPU. And the more "translucent over translucent" pixels are appearing, CPU loading is increasing in geometrical progression, It's a "bottleneck" effect as it gets.

The are few possible ways to optimize.

1. Use look-up table for translucent colors, just like original paletted render does. Using original TRANMAP/TINTMAP or something doesn't seems to be possible as it contains differently aligned data. I was trying to generate such map via existing code by replacing byte to pixel_t types and allocating not 256*256 but higher value, but matters no how and what I have tried, it always ended up with SIGSEGV fiasco.

If done correctly, the result should look like this, but this is HighColor LUT:

image

Fabian was also able to calculate how tough will be TrueColor LUT. I can't find his answer, but it something about 32 Gigabytes.

2. Compute translucency not via CPU, but via GPU. This will require some knowledge of Direct3D or OpenGL, I simply don't have it.

3. Fabian have a though, I'll gladly quote:

Using a lookup table even for truecolor translucency, but I'll have to invent a way to break down 24-bit RGB values into an 8-bit space as lossless as possible.

But it's only a though, and I was never willing to ask him "how / when / wanna-wanna".

JNechaevsky commented 6 months ago

There is something wrong in Hexen's vanilla code of transitions between levels - when entering portal to another map, even "Ethereal Travel" banner appears not before, but after new level is loaded. Thus, same applies to crossfading effect. Going to another hub after text screens and loading a save game seems to be fine. 🤔

Enforcing a wipe does not helps either, still not sure how to solve it.

JNechaevsky commented 5 months ago

Well, it's seems to be almost done. There is still small problem with traveling between levels in one hub (00:05 on video), and still no idea what to do. But looks pretty decent with loading/traveling banners disabled, luckily they are optional already.

https://github.com/JNechaevsky/international-doom/assets/21193394/009fa9a0-ef31-49da-a729-e908b3b0236d

Meerschweinmann commented 5 months ago

Heyhey, a Hexen fading progress 😊 Looks really nice. When i have to choose between banners and fading, i choose fading.

JNechaevsky commented 5 months ago

I'll be honest. This implementation is flawed. 😐 There two notable problems:

  1. When crossfade is happening, there is small yet notable picture "darkening" that should not happen.
  2. In the code, it's a real mess of magic numbers and tricks.

Probably the last nail in this ~coffin~ implementation must be a small improvement in the of fade effect to make it slightly "smoother" by removing notable "from too dark to normal" effect.