Game Development Community

Blending from black and white to colour

by Andy Hawkins · in iTorque 2D · 09/04/2012 (7:32 am) · 6 replies

One of my students wants to make a game where her horse paints a black and white world with colour in the wake of it's swishing tale. I figured it could be done with 3 layers, BW, a mixing inbetween layer and a colour layer. Is it possible to "write" arbitrarily to a middle layer to have the blend effect work this way? It would be some sort of pixel set method. Not sure if Torque can do this. Any ideas on how she could achieve this effect?

#1
09/04/2012 (11:04 am)
Hmmm... I think I'd probably use a mask layer behind the horse (in profile) so that the mask/opacity layer reveals the colour image behind the greyscale image. Not sure how you'd do it mathematically though. I suppose I'm thinking of a 2d side-scroller type affair.
#2
09/04/2012 (6:06 pm)
Yep it's for a side scroller. But how do a effectively "stamp" the image of the horse into the layer so as it moves it "cut" out the mask?
#3
09/04/2012 (9:23 pm)
Having hard time visualizing the set-up, as a horse tail usually
moves from side to side with minimal up down motion. However, one
idea would be to "scroll" the grayscale as the horse moves to reveal
the color image. Scroll in this context refers to rendering the grayscale and "cutting off" the sections needed to reveal the color image, and not rendering that portion. This is with a left to right
or right to left movement of the horse in mind. The render rectangle
would just need to be updated with however many pixels you are subtracting with each unit of horse movement.
#4
09/05/2012 (11:50 pm)
Well really they want to do this. Have the scene in black and white and a colour one. Just using a circular brush would be fine. Over time the "brush" would colour the background as in this pic. (this mock up is done in photoshop erasing the black and white image with an eraser working on the layer mask). Can that sort if thing be done in Torque?

drewfx.com/Torque/pics/ponyDrawing.jpg
#5
09/06/2012 (9:25 am)
Perhaps a dynamic mask will work. Not sure how or if iTorque2d
handles masks. Grayscale on bottom, colour version over the
grayscale and update the mask for colour version as horse moves
about the scene. At start the colour version mask would be transperant
and as you move the horse update the pixels of the colour mask to
full opaque so that you see the colour image instead of the grayscale
version. Using ordinary mask tech as an example, the initial mask
would be full black (0,0,0), then the areas where you want to see the
colour image would need to be filled with full white ( 255,255,255).
However iTorque treats transperancy, you should be able to devise a
scheme with this idea in mind.My previous suggestion was for using
the tech associated with sprite sheets or atlas where you read into a
texture and then update a rectangle much like render targets or a
stretch blit to cut off linear portions and would be useless in this case.
#6
09/06/2012 (10:46 pm)
It give me an idea, if the following is not possible.

1) How do you write pixels to the mask?

2) The idea I have is paste a sprite to the mask (layer). Paste heaps over time, quantising their position so as to not draw too many - Might slow game down though.