supertux icon indicating copy to clipboard operation
supertux copied to clipboard

Set background color on lightning

Open tobbi opened this issue 2 years ago • 16 comments

Fixes #1243

tobbi avatar Sep 06 '23 13:09 tobbi

https://github.com/SuperTux/supertux/assets/583169/20867e9b-7244-4ccc-b9fb-a32b7b13845e

tobbi avatar Sep 06 '23 13:09 tobbi

https://github.com/SuperTux/supertux/assets/583169/59f2b905-d870-4d70-985a-aca4a1151211

tobbi avatar Sep 06 '23 20:09 tobbi

Not sure how far we can go in terms of brighting up the screen, but the flash should be very bright! Perhaps working with something on an "additive layer" would help out. I also think that it looks much nicer if the flash appears immideatly upon lighting strike but then fades out rather than dissappearing instantly again.

Rusty-Box avatar Sep 06 '23 20:09 Rusty-Box

Something along the lines of this, if brighter:

lightning_before_after

EDIT: There really should be a strong difference between the two states

Rusty-Box avatar Sep 06 '23 20:09 Rusty-Box

https://cdn.discordapp.com/attachments/1033726844660351026/1195497037022646393/2024-01-12_23-37-31.mp4?ex=65b43460&is=65a1bf60&hm=b6bf7468679146e4310aab59ec96144d00245653cb7985e0d269b30d8295c7ed&

tobbi avatar Jan 12 '24 23:01 tobbi

Personally I find the thunder too bright, making it uneasy on the eyes. Would there be an option to turn this off?

provigz avatar Jan 12 '24 23:01 provigz

Personally I find the thunder too bright, making it uneasy on the eyes. Would there be an option to turn this off?

This was Rusty's idea. Battle with him.

tobbi avatar Jan 21 '24 02:01 tobbi

It appears the white surface drawn when lightning strikes isn't even colored white. It looks rather gray. Even when the ambient light is set to r=1, g=1, b=1. Is its alpha value set to 1 when it flashes?

Rusty-Box avatar Jan 24 '24 14:01 Rusty-Box

Ideally, if we get the flash to be white we may not even have to tamper with the ambient light at all during the flash as the blend mode "add" brightens it all up anyways (unless I am mistaking, though that's how it works with a pure white gradient set to "add" and a z-layer of 500).

Rusty-Box avatar Jan 24 '24 14:01 Rusty-Box

It starts at 1 and then quickly levels off to 0.

tobbi avatar Jan 24 '24 14:01 tobbi

Huh, it doesn't look like it though at all. I did notice something else though too. You should remove the stuff related to const Color Color::LIGHTNING_HIT_COLOR(0.6, 0.6, 0.6, 0.5); because it actually makes a fully bright sector darker when lightning strikes

Rusty-Box avatar Jan 24 '24 14:01 Rusty-Box

Not sure if that fixes all of it though since the white surfaces appears as not white even in a fully bright sector too.

Rusty-Box avatar Jan 24 '24 14:01 Rusty-Box

This is how it is supposed to look like. To give you a visual reference! Note: I used a scripted Gradient object for this!

https://github.com/SuperTux/supertux/assets/20615048/86e72405-97d5-4da0-95d9-184b5f44761a

Rusty-Box avatar Jan 24 '24 14:01 Rusty-Box

https://github.com/SuperTux/supertux/assets/583169/ec82e7d8-983e-4ef2-ac3b-ce26f21b373f

tobbi avatar Jan 28 '24 16:01 tobbi

I'm still convied that the blending mode didn't really apply. For comparison I set up a Gradient Object with the same values as the drawn lighning flash you added (and on the same z-layer -> 500). But as you can see it is not the same. I don't know why and rn my only assuption is that the code may not support blending modes for you methode of drawing it.

Gradient set to r:1, g:1, b:1, a:0.9 and blend mode "Additive": screenshot000011

Lighning Flash in this PR, which is supposedly also "Additive": screenshot000012

Rusty-Box avatar Jan 28 '24 17:01 Rusty-Box

I think this code could be much better, but this works

In what way could the code be better?

tobbi avatar Jan 28 '24 20:01 tobbi

https://github.com/SuperTux/supertux/assets/583169/70300238-2ee6-4213-b0a5-89a2ec4a357e

tobbi avatar Mar 02 '24 16:03 tobbi