that semi-transparent effect

Request patches for Keens 4-6.
Post Reply
Bernie
Posts: 124
Joined: Sat Sep 22, 2012 2:28 pm
Location: Aus

that semi-transparent effect

Post by Bernie »

You guys know what im referring to, right? that whole thing about making certain parts of a tile's mask white while giving it colour in its pic, thus creating a 'tint' in the game.

well i was just wondering if there was any way to change how certain colours interact with certain background colours. cause im using some 'tinted' tiles that look good against one colour in a background, but not so good against another colour. also, i thought it might look cool if the colours darkened in the tint (like tint on car windows) cause i *think* it usually seems to make the tint go towards lighter colours (or atleast it seems that way for me), but generally speaking i'd like to know if theres a patch to control how colours tint.

and yeah i had a poke through the palette patches but i couldnt see anything about it.
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass »

In Keen Galaxy the tiles work additively when not masked, that is a blue translucent tile in front of a red background is purple. This works for sprites and foreground tiles.

Given this it's easy to see what a given tile tiny will do in front of any background or color. This is why my next mod will not feature translucent flames, they look good against say, rock backgrounds, but in blue sky turn white.

The best colors to use are the dark colors blue, red and green, which add the minimum to anything behind them. Aside from this, there is not much you can do.
Bernie
Posts: 124
Joined: Sat Sep 22, 2012 2:28 pm
Location: Aus

Post by Bernie »

Aside from this, there is not much you can do
ah okay then. thanks levellass.

PS is this 'effect' actually some sort of error? i had that feeling about it, partially cause the original keen games never used it (i dont think). also would you know if it takes more memory using it, by any chance?
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass »

The effect is a logical result of how the game draws its graphics and it does not matter at all how much of a level's tiles say, use it. A similar, but different effect occurs in Keen 1-3, due to the different way it handles masked tiles.
User avatar
troublesomekeen
Posts: 223
Joined: Fri Feb 03, 2012 7:56 pm
Location: Shadowlands
Contact:

Post by troublesomekeen »

By the way... How DOES Keen1-3 deal with masked tiles? I can't believe how badly I'm stumped by Vorticons. I don't understand how the game knows how to display only a portion of a 16 by 16 foreground tile.
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass »

A tile given the 'masked' property in Keen Vorticons uses the next tile in the tileset as a mask, all tiles are still 4-plane EGA, not 5 like in Keen Galaxy.

The game will display colors in a complex manner:

1.) If the mask is light, then light colors will show through, if it doesn't, all colors will be dark

2.) Everything else is messed up.
Draik
Posts: 117
Joined: Sat Jul 26, 2008 8:52 am
Contact:

Post by Draik »

something something XORs. Experimentation is the best way to get desirable results.
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass »

I thought that was Keen galaxy not Keen Vorticons?
Draik
Posts: 117
Joined: Sat Jul 26, 2008 8:52 am
Contact:

Post by Draik »

Y'know, I don't actually know, having never poked the code. I know I read it somewhere, but I'm basing it mostly on the telltale munching squares that showed up when I did some experiments with the effect (but those involved both V2 and palette patching, so their "real world" application might be different).
lemm
Posts: 554
Joined: Sun Jul 05, 2009 12:32 pm

Post by lemm »

For sprites and masked tiles in Galaxy, first the mask plane is ANDed with whatever it is being drawn atop. That means if the mask is 0 (black) the whatever-is-there is erased (to blackness), and if it is 1 (white) the whatever-is-there is not erased.

After that, each of the four color planes are ORed (i.e., added) to the result of the AND operation.



The only time a XOR operation is used IIRC is in drawing the fonts, which is why you get weird opposite color effects if you don't draw on a white background.
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass »

This clears up a lot, many thanks. But what about Keen Vorticons?
lemm
Posts: 554
Joined: Sun Jul 05, 2009 12:32 pm

Post by lemm »

In Vorticons, graphics are drawn in the order normal tiles, sprites, foreground/masked tiles and sliding doors.

In Vorticons, the masked tiles actually do the ANDing on a per-plane basis. That means the red plane of the masking tile will AND with the red plane of whatever was behind that tile, the blue plane of the masking tile will AND with the blue plane of whatever was behind that tile, and so forth. On the other hand, Galaxy only uses one masking plane for ALL colors, either everything behind the mask is erased, or nothing is.


You can still get a translucent effect in Galaxy by drawing a color plane where there mask bit is 1 (ie, white using modkeen, or using colors 16-31 in KeenGraph), but it's not quite the same as what you could achieve in Vorticons.
Post Reply