Colour Tinting Sprites

Started by CaptainBinky, Sun 12/08/2007 19:21:41

Previous topic - Next topic

CaptainBinky

Hello.

We've recently added lightmap functionality to AGX so that we can drive smooth colour tinting values of sprites from separate per-room colour map bitmaps.

Now, what we were kind of expecting to do having not thoroughly researched the way it worked in AGS ;) was to have an RGB image where each pixel specified the exact colour tint value of the sprite. So therefore, 255,255,255 would be the sprite unchanged 0,0,0 would be a completely black sprite and all values in-between.

However the system in AGS is slightly different to this and has an RGB tint value and an amount. We figured we could drive the amount off of the alpha - thereby having an RGBA bitmap. Unfortunately, on further research the AGS tinting system is less compatible with a lightmap system than we thought.

We expected a tint of 0,0,0 and an amount 100% to be a black sprite, but it comes out white. So we thought it might be reversed, but 255,255,255 and 100% also comes out white.

So it appears that we can either drive the lightness of a sprite using the lightness amount OR we can drive a hue/saturation of the sprite, but not both with one nice neat RGB tint..

Can someone enlighten us to how this system works?

As an example, one of the rooms we're adding the lightmap support for is a dark room with a fire in it. Behind the fire, we want the character to be tinted orange, which fades down to black as you move in front of the fire, and fading to the sprite's original colour when you're at the edges of the screen. Can this be done with AGS, and if so how (without resorting to multiple regions)?

Cheers,

Cap'n Binky

A Lemmy & Binky Production

Pumaman

Well, probably the easiest explanation is this from the manual's SetAmbientTint description:

The SATURATION parameter defines how much the tint is applied, and is from 0-100. A saturation of 100 will completely re-colourize the sprites to the supplied colour, and a saturation of 1 will give them a very minor tint towards the specified colour.

CaptainBinky

#2
Thanks Pumaman,

However how do you tint towards a dark colour? I can make it go dark using the lightness amount (although oddly, not completely to black) or I can make it go a bit orange using the tint options. But I can't make the sprite dark orange.

From what you're saying, setting the saturation to 100% and setting the colour to 0,0,0 ought to make the sprite go black but it doesn't - it goes pure white.

Is there some way to do this that I'm missing?

Cap'n Binky

edit: In fact, if you set R:2 G:1 B:1 and amount:100% you tint the sprite pink. Setting R:255 G:127 B:127 and amount:100% tints the exact same pink. Which is a bit weird really.

A Lemmy & Binky Production

Grim

I have this problem as well. In my game some backgrounds are in black&white and so should be character. Unfortunatelly all I can achieve is very mild colours, close to black&white, but not fully greyscale...

monkey0506

I believe to do greyscale you would use: Character.Tint/Object.Tint/SetAmbientTint(100, 100, 100, 100, 100); or Region.Tint(100, 100, 100, 100); (Region.Tint has no luminance parameter and is always passed as 100)

Quote from: Gilbot V7000a on Thu 27/04/2006 02:29:40If it's used as an object or a character, try using the Tint() function and set all 5 parameters to 100, unfortunately that doesn't look very well as colours like (100R, 0G, 0B) would be changed to full white.

Speaking of that...the thread I quoted Gilbot from makes mention of the possibility of a DynamicSprite.Tint function. Any word on that?

SMF spam blocked by CleanTalk