Closed geraintwhite closed 8 years ago
This is a relevant discussion about pallet dithering: http://www.pouet.net/topic.php?which=10003&page=1
This is the current result from the dithering:
There are probably some mistakes in the maths.
This is an alternative method which just goes through some blue colours:
def sky(x, y, time, sun, lights):
""" Returns the sky colour. """
if sun[0] in [x, x+1] and sun[1] == y:
# Sun pixel
return YELLOW if cos(time) > 0 else WHITE
else:
# Sky pixel
day, night = (0, 0, 1), (0, 0, 0.2)
shade = (cos(time) + 1) / 2
if any(map(lambda l: lit(x, y, l), lights)):
return rgb(*day)
else:
return rgb(0, (5-((15*shade//2)%6))/5, (5-((15*shade)%2))/5)
# return rgb(*(lerp(day[i], shade, night[i]) for i in range(3)))
The sun should also have a glow around it
The day/night transition still has some shades in the wrong order.
Also, we need to consider the performance - these changes make the game significantly more laggy.
The colour_lerp
still needs working on...
Yes, we may want to simplify the visuals of this a lot, I'm not even sure if I like the look, it makes it very noisy.
Although I haven't noticed the performance difference, I suppose it is because there are more colour changes/bigger diff, and crosh doesn't handle that as well as xfce-terminal
There is also a problem with picking the lightest colour to render, ATM we pick the value closest to it's source without considering the actual brightness of the colours. It seems like we might want to use HSL for both finding the brightness, and doing the actual lerp: http://www.alanzucconi.com/2016/01/06/secrets-colour-interpolation
Although that could get expensive...
So with HSV colour conversion, we get a nice transition, but there is obvious banding. We should use spacial dithering (not pallet dithering) to hide this.
Regarding #81, this is a smoother transition between night and day with four colours. It can be improved to go through more shades.