It is currently Mon Dec 18, 2017 3:34 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 36 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: Mon Sep 19, 2005 11:22 am 
Offline

Joined: Thu Sep 15, 2005 9:23 am
Posts: 1194
Location: Behind you with a knife!
If Sprite 5 and Sprite 20 are drawn in exactly the same place, with 5 behind the bg and 20 in front, and all of Sprite 5's pixels are transparent then does sprite 20 get drawn?

In other words if a pixel is transparent then does it count as having a higher priority?

The reason that I am asking this is because in Castlevania I know that when you enter the castle you are supposed to enter it through the door using the afformentioned method. BUT it does not seem to work.

If I do it so that a pixel takes priority whether it is transparent or not then Castlevania seems to work, but other games then seem to suffer. I am very confused...

_________________
http://www.jamesturner.de/


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 19, 2005 11:57 am 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1393
Transparent pixels are ignored when determining relative sprite priority - in this case, you will see sprite #20.

_________________
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 19, 2005 12:08 pm 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7322
Location: Chexbres, VD, Switzerland
You'll see sprite BG, then sprite 5, then sprite 20. If sprite 5 is transparent, if makes no effect, but if it is black, then you see sprite 5 behind the BG, then sprite 20 isn't visible because it has a black pixel from sprite 5 above it, this one isn't visible for the player because the BG transparent color is also black.

_________________
Life is complex: it has both real and imaginary components.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 19, 2005 1:40 pm 
Offline

Joined: Thu Sep 15, 2005 9:23 am
Posts: 1194
Location: Behind you with a knife!
So how does Castlevania make the main character enter the door and go behind the wall when you enter the castle? I have checked and the character remains a fg sprite and there is also a background sprite that is fully transparent which it is supposed to hide behind. If transparency does not affect the priority of a pixel then how do they manage it?

_________________
http://www.jamesturner.de/


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 19, 2005 5:04 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1393
The sprite is not transparent - it is simply the same color as the background. The actual colors are irrelevant; the PPU does not determine the actual color to display until AFTER it has determined which sprite to draw.

_________________
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 20, 2005 2:24 am 
Offline

Joined: Thu Sep 15, 2005 9:23 am
Posts: 1194
Location: Behind you with a knife!
If the sprite is the same colour as the background, then surely it would be totally transparent and therefore have no priority?

_________________
http://www.jamesturner.de/


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 20, 2005 4:13 am 
Offline
User avatar

Joined: Mon Sep 27, 2004 8:33 am
Posts: 3715
Location: Central Texas, USA
Argggh! The PPU is color-blind up until the last moment; it only sees palette indicies when composing graphics. All that's relevant for transparency is whether the two low bits of the palette index are zero (the two bits specified in CHR data, as opposed to the higher bits specified by the attributes or whether it's BG/OBJ sub-palette). It's not like the "chroma key" on TV where they have a blue/green screen behind and anything approximately matching that color is transparent to the underlay.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 20, 2005 9:18 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7322
Location: Chexbres, VD, Switzerland
In other words, the sprite isn't transparent, it's black, and the BG is also black so the sprite is invisible, while not techically transparant.

_________________
Life is complex: it has both real and imaginary components.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 20, 2005 9:28 am 
Offline

Joined: Thu Sep 15, 2005 9:23 am
Posts: 1194
Location: Behind you with a knife!
Bregalad wrote:
...so the sprite is invisible, while not techically transparant.


So... What's the difference between the two?

_________________
http://www.jamesturner.de/


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 20, 2005 10:27 am 
Offline
User avatar

Joined: Wed Nov 10, 2004 6:47 pm
Posts: 1845
Color 0... and ONLY color 0 is transparent ($3Fx0, $3Fx4, $3Fx8, $3FxC). If the sprite is to draw any color other than those colors the pixel is NOT TRANSPARENT. Whether or not the drawn pixel will be indistinguishable from the background to the user... the NES doesn't care.

So if the game has a black background and a fully black sprite on top of it... a human won't be able to tell where the sprite is by looking at the screen (since the same color is being drawn everywhere) -- but that doesn't necessarily make the sprite transparent. It just makes it blend in.


So agian... the only thing that matters when determining whether or not a sprite/bg pixel is transparent is if both the CHR bits are 0. Attribute bits don't matter.. the palette doesn't matter... nothing else matters. If the bg/spr is outputting color 0, it's transparent, if it's outputting color 1-3, it's opaque.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 20, 2005 10:57 am 
Offline

Joined: Thu Sep 15, 2005 9:23 am
Posts: 1194
Location: Behind you with a knife!
Transparency is defined by (0x3F00). So if 0x3F02 has the same value as 0x3F00, is 0x3F02 transparent?

I understand what you say about the human eye not being able to see the sprite if it is that same colour as the bg but please try Castlevania and you will see what I mean. Using priorities, they make the main character dissapear when he enters the door.

Also is 0x3F00 mirrored to 0x3F04, 0x3F08, 0x3F0C, 0x3F10, 0x3F14, 0x3F18, 0x3F1C?

_________________
http://www.jamesturner.de/


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 20, 2005 11:11 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7322
Location: Chexbres, VD, Switzerland
WedNESday wrote:
Transparency is defined by (0x3F00). So if 0x3F02 has the same value as 0x3F00, is 0x3F02 transparent?

No.

Quote:
Also is 0x3F00 mirrored to 0x3F04, 0x3F08, 0x3F0C, 0x3F10, 0x3F14, 0x3F18, 0x3F1C?

Yes.

_________________
Life is complex: it has both real and imaginary components.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 20, 2005 11:13 am 
Offline

Joined: Thu Sep 15, 2005 9:23 am
Posts: 1194
Location: Behind you with a knife!
Argh!!!!!!!

Then in that case, can somebody please explain palettes to me in a post. Please don't refer me to any txt files, I have read them all. Leave no detail out...

_________________
http://www.jamesturner.de/


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 20, 2005 11:45 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7322
Location: Chexbres, VD, Switzerland
The color written at $3f00, that is mirrored to $3f04, $3f08, $3f0c, $3f10, $3f14, $3f18 and $3f1c, is the transparent color. Only writes to $3f00 and $3f10 are taken care (so a write, for example to $3f1c, is without effect).

After all the priority calculations, the color drawn of the screen can be from a sprite image (that has high priority, or that have low priority and is behind a transparent BG pixel), or from a bg image (if there is no sprite, if there is a sprite with lower priority that is behind a non-transparent BG pixel, etc...), if no pixel has to be shown from BG nor sprites, the transparent color will be there.

The value of the color themselves have nothing to do with the priorities or transparent pixels.

_________________
Life is complex: it has both real and imaginary components.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 20, 2005 11:55 am 
Offline
User avatar

Joined: Wed Nov 10, 2004 6:47 pm
Posts: 1845
Bregalad wrote:
Quote:
Also is 0x3F00 mirrored to 0x3F04, 0x3F08, 0x3F0C, 0x3F10, 0x3F14, 0x3F18, 0x3F1C?

Yes.


Actually... no.


Here's the deal:

$3F10 mirrors $3F00
$3F14 mirrors $3F04
$3F18 mirrors $3F08
$3F1C mirrors $3F0C

$3F20-$3FFF mirrors $3F00-$3F1F


$3F00/$3F04/$3F08/$3F0C are NEVER DRAWN as part of a BG/sprite. Never never never never... since they are the 'color 0' value of the graphic (though they all exist, and can be used for the BG color when rendering is disabled). $3F00 holds the "background color" which is drawn if BOTH BG/Sprite pixels are transparent. (Note that $3F00 is the bg color only if rendering is enabled -- if rendering is disabled [both bg and sprites disabled] then it is possible for the game to use any palette entry as the bg color)

logic flows kind of like this (note: only true when rendering enabled) :

Code:
if sprite pixel is not transparent
 -> if sprite pixel has foreground priority, render it
 -> otherwise if background pixel is not transparent, render it
 -> otherwise render sprite pixel
else (sprite pixel is transparent)
 -> if background pixel is not transparent, render it
 -> otherwise (both are transparent), render color at ppu$3F00


For areas of the screen where there is no existing sprite -- the sprite pixel is transparent. If sprites are disabled, or if the sprite pixel is in the left 8 pixels of the screen and sprite clipping is turned on... the sprite pixel is transparent. Otherwise transparency is determined by CHR bits of the sprites graphic: 0=transparent... 1,2,3=opaque. If the BG is disabled or in the clipped range (left 8 pixels of the screen when clipping enabled), the BG pixel is transparent -- otherwise BG transparency depends on the BG graphics CHR bits -- same as sprites.

Attribute bits and palette lookup do not come into play at all until AFTER it's determined which pixel will be displayed.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 36 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group