
The most impatient:
lagging demo ,
written in chrome . My machine boots for about 20 seconds.
This idea came to me about 2 years ago. I drew attention to the fact that, in conditions of insufficient lighting, I perceive visible objects mainly in bluish tones and with a slight loss of sharpness. Perhaps this is a purely psychological perception, but this is not what we are talking about right now. I was curious how a 2D game with such lighting features would look like. In order to find out, I, without having understood the shaders, sketched a demo in the most convenient language for me - javascript. Since the effect is applied to dimly lit areas, it is not the most noticeable of what is happening on the screen, but it adds quite tangible charm.
The result is obtained from three buffers:
On the first buffer, a picture is formed to which the post effect will be applied;
The second buffer is used for motion-blur of the light map. According to the meaning, it realizes “memory” - after the plot is lit, it will still be visible for a while, even if no light source is already directed at it.
The third one draws the light map itself - lighting with geometric shadows for the current frame.
')
Each frame of the second buffer is shaded and blurred, the third buffer is displayed on top of it. The result is used as information for the post-effect: at relatively high values of illumination, the pixel is shaded by the standard algorithm, and at low values, a faint blur and a gradual attenuation of the red and green channels begin.
In my implementation, the blur from the post-effect is calculated for 255 radii even before launch, and it takes 20-30 seconds.
The older version, more nimble, without geometric shadows and with an abundance of bydlokod can poke
here .
Fresh, with shadows -
here .
Both versions were written in chrome. My Firefox also seems to be trying to draw everything, but it perceives the mouse coordinates incorrectly (I will be grateful if someone tells you how to fix it), and the FPS will be lower (probably, just the old version). I have no operas.
Management in the latest version:
LKM - create
convex objects from which the shadow will be cast. The direction of creation (clockwise or counterclockwise) has a difference.
PKM - cancel creation / delete object under the arm.
SCM - turn on / off the second light source.
The blur algorithm was taken
from here .
Background picture from the recently released game
They bleed pixels .