Reputation: 1562
A programmer told me that he used an array technique for manipulating individual pixels on screen to attain a very specific look in his (Java?) game. This is his outcome:
(source: awkwardknight.com)
That is the exact same thing I am trying to get: the 'lightsource' (or just a general area) that nullifies the tinted layer around it to make it seem like light is illuminating its vicinity. This is the programmers exact words: "The way Caelis renders uses a pixel array representing each pixel on the screen and using a function, you can iterate and darken/lighten whatever you want."
I can't understand how to do this. I've never done anything like this. Right now I have an 'SKShapeNode' serving as my tint layer with the alpha varying on time of day (which I get from 'NSDate'). But I can't change individual pixel alphas.
Can someone please explain how to write such a function? Maybe some example code? Would be very appreciated since I don't know how to write a custom shader either U_U
Upvotes: 1
Views: 76
Reputation: 11696
Manipulating every single pixel (or point) on the screen sounds like an extremely inefficient way of doing things.
To achieve the day/night effect in the animation, I suggest you create 2 or more layers. One for day, one for night and perhaps one for the transition. Then you place each in the view with different zPositions. To transition from one "ambiance" to another, use a timed alpha fade in for the new and fade out for the old.
Upvotes: 2