Sprite color combination

Page 1/3
| 2 | 3

Par Metalion

Paragon (1491)

Portrait de Metalion

02-01-2008, 19:20

Hi,

I am using the CC bit in the color table of the sprites (screen 5 - mode 2) in order to create a 3 colors result out of 2 layers of sprites overlapping.

I have 3 sprites with color 1 (sprites 0,1,2) and 3 sprites with color 4 (sprites 3,4,5). Sprite 3 is over sprite 0, sprite 4 is over sprite 1 ans sprite 5 is over sprite 2. The color table for sprite 0,1,2 is 1, the color table for sprite 3,4,5 is 64+4 (CC bit set to 1).

So each overlapping bits should be color 4 OR color 1 = color 5. It does works for the sprite pairs 4/1 and 5/2 but does not work for the sprite pair 3/0 (in BlueMSX 2.6.1, did not perform a test yet on my MSX2+).

Am I missing something ?

!login ou Inscrivez-vous pour poster

Par GhostwriterP

Hero (660)

Portrait de GhostwriterP

02-01-2008, 19:33

Shouldn't the sprites be following pairs? 0 OR 1 , 2 OR 3 , 4 OR 5.

Par Metalion

Paragon (1491)

Portrait de Metalion

02-01-2008, 20:38

Shouldn't the sprites be following pairs? 0 OR 1 , 2 OR 3 , 4 OR 5.

I don't think so ...
Furthermore, the 4/1 and 5/2 pairs works just fine, it's just the 3/0 that do not OR their colors.

Par PingPong

Prophet (3885)

Portrait de PingPong

02-01-2008, 21:26

Metalion: have you checked that on the row (or sprite) where you expect the third color is there almost 1 overlapping pixel?

Par Edwin

Paragon (1182)

Portrait de Edwin

02-01-2008, 22:23

GhostwriterP is right. Obviously Tongue

A sprite with the CC bit set will or with the sprite of next higher priority that should not have the CC bit set. So if you set sprite 9 with the CC bit, it will or with sprite 8.

Par Metalion

Paragon (1491)

Portrait de Metalion

02-01-2008, 23:14

@PingPong : Yes, they are completely overlapping, as they share the same XY coordinates by pair.

A sprite with the CC bit set will or with the sprite of next higher priority that should not have the CC bit set. So if you set sprite 9 with the CC bit, it will or with sprite 8.
I am really doubtful about what GhostwriterP is saying ... First of all, I have never seen written somewhere that the sprites should only OR their color with the next sprite and ONLY that one. However, it has always been explained that a sprite would OR its colors only with a sprite on a higher priority plane.

MSX2 technical handbook says :

1) Conflicts are not detected when the pattern of the sprite whose
   CC is "1" is piled on the portion CC=0 of the sprite which has
   a smaller number and is nearest to it.
2) To display the sprite whose CC is "1", CC bit of the sprite which
   has smaller number should be set to 0.

Furthermore, as I already said : it works fine with sprite pairs 4/1 and 5/2.
It is just not working with sprite pair 1/0.

And to give additional info : when I say "sprite pair b/a", I mean that sprite a and sprite b share exactly the same XY coordinates, and that sprite b is fully overlapping sprite a.

Par PingPong

Prophet (3885)

Portrait de PingPong

02-01-2008, 23:42

Metallion: for overlapping i mean that physicallyalmost two points of the two layers are overlapping, not only that coordinates are overlapping.
In other words: there must be a form of 'collision' between the two layers. Even with coordinates overlapping, maybe there is no overlapping if there are not common point turned on between the two layers.

This is what i mean with check overlapping layers. Wink

Par Metalion

Paragon (1491)

Portrait de Metalion

02-01-2008, 23:49

PingPong : Ok, I see what you meant ... Yes they do have overlapping pixels.

Par PingPong

Prophet (3885)

Portrait de PingPong

03-01-2008, 11:34

PingPong : Ok, I see what you meant ... Yes they do have overlapping pixels.

--- so now, it's working?

Par Metalion

Paragon (1491)

Portrait de Metalion

03-01-2008, 13:46

--- so now, it's working?
No, it is still not working.

Par SLotman

Paragon (1240)

Portrait de SLotman

03-01-2008, 16:52

Well, first of, try it on a real MSX, or at least on another emulator. If it's still not working, maybe it's your code, or how you're setting the sprite colors... but it will be difficult to spot that without seeing any code...

The tests I did, you can even overlap more than 2 sprites, you can overlap 3/4/5 and MSX will keep making OR between the color indexes (are you taking that into account? because color 14 and color 15 obviously will show as color 15, giving the impression of no color "blend" at all)

Page 1/3
| 2 | 3