It is currently Thu Jul 19, 2018 5:05 am

 All times are UTC - 7 hours

 Page 1 of 1 [ 6 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: Sprite Limitation/Correct Sprite PrioritiesPosted: Thu Sep 15, 2005 9:20 am
I am a little confused with the 8 sprite limit per scanline rule.

If sprites 57-63 are drawn in the first 10 pixels of a scanline and sprite 5 is drawn at 100 pixels in and sprite 6 is drawn at 200 pixels then which sprite is drawn? 5 or 6? i.e. does the limit go from sprite 63.0 or what is drawn from left to right on a scanline?

Also, if sprite 10 (bg sprite) is drawn on pixel 123 of a scanline and sprite 11 (fg sprite) is drawn on the same pixel then the latter wont get drawn. Do any games exist so that we can test this?

Top

 Post subject: Re: Sprite Limitation/Correct Sprite PrioritiesPosted: Thu Sep 15, 2005 10:20 am

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1418
james123 wrote:
If sprites 57-63 are drawn in the first 10 pixels of a scanline and sprite 5 is drawn at 100 pixels in and sprite 6 is drawn at 200 pixels then which sprite is drawn? 5 or 6?

Both - in that setup, you will see sprites 5, 6, 57, 58, 59, 60, 61, and 62. X position has nothing to do with sprite priority, since it doesn't even get checked until after the PPU has chosen its 8 sprites to render (based entirely on Y coordinates, choosing the first 8 sprites it finds starting at sprite #0 and ending at sprite #63).

Quote:
Also, if sprite 10 (bg sprite) is drawn on pixel 123 of a scanline and sprite 11 (fg sprite) is drawn on the same pixel then the latter wont get drawn. Do any games exist so that we can test this?

Yes - Super Mario Bros. 3 uses this exact trick whenever an item comes out of a [?] block or whenever something enters or exits a pipe (either Mario or an enemy).

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

Top

 Post subject: Posted: Thu Sep 15, 2005 10:29 am

Joined: Thu Sep 15, 2005 9:23 am
Posts: 1194
Location: Behind you with a knife!
Thanks for the second one, but WedNESday can only run NROM games at the moment...

What i mean by the first one is if sprites 64,64,63,62,61,60,59 are drawn at the start of a scanline, and sprite 57 is drawn at pixel 100 and sprite 58 is drawn at pixel 200 BOTH can't be drawn because that would be 9 sprites. What I mean is does the NES increment from sprite 64th...1st or increment when it finds a sprite on a scanline? (kinda hard to explain)

_________________
http://www.jamesturner.de/

Top

 Post subject: Posted: Thu Sep 15, 2005 10:55 am

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1418
The LOWEST numbered sprites are the HIGHEST priority - this means that if all 64 sprites are on the first scanline, you will only see sprites 0, 1, 2, 3, 4, 5, 6, and 7 (SPR-RAM \$00-1F).

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

Top

 Post subject: Posted: Thu Sep 15, 2005 11:10 am

Joined: Mon Sep 27, 2004 8:33 am
Posts: 3715
Location: Central Texas, USA
I'm pretty sure Castlevania uses this "lower-numbered sprite behind the background to mask a sprite in front" technique when you walk through the door at the beginning and when a hidden money bag ascends from the floor (the first of which is hidden within a few hundred pixels of the door mentioned above). These didn't appear correct in my emulator until I implemented the "background pushed in front of front sprites" behavior you're referring to.

As far as sprites per scanline, it's really very simple. For each scanline, scan sprites from 0 to 63, in that order. Examine each sprite's Y coordinate in combination with the global sprite height (8 or 16) to determine whether any of its lines fall on this scanline. Once eight sprites are found for the scanline (or all sprites have been examined), stop and draw them.

Top

 Post subject: Posted: Fri Sep 16, 2005 12:19 pm

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7443
Location: Chexbres, VD, Switzerland
blargg wrote:
I'm pretty sure Castlevania uses this "lower-numbered sprite behind the background to mask a sprite in front" technique when you walk through the door at the beginning and when a hidden money bag ascends from the floor

I'm absolutely sure, myself. It's a shame that games such as Just Breed didn't use this techniques to allow the player to pass behind trees, chimneys, etc...

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

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 6 posts ]

 All times are UTC - 7 hours

#### Who is online

Users browsing this forum: No registered users and 2 guests

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

Search for:
 Jump to:  Select a forum ------------------ NES / Famicom    NESdev    NESemdev    NES Graphics    NES Music    Homebrew Projects       2018 NESdev Competition       2017 NESdev Competition       2016 NESdev Competition       2014 NESdev Competition       2011 NESdev Competition    Newbie Help Center    NES Hardware and Flash Equipment       Reproduction    NESdev International       FCdev       NESdev China       NESdev Middle East Other    General Stuff    Membler Industries    Other Retro Dev       SNESdev       GBDev    Test Forum Site Issues    phpBB Issues    Web Issues    nesdevWiki
Powered by phpBB® Forum Software © phpBB Group