It is currently Thu Oct 19, 2017 6:10 pm

All times are UTC - 7 hours



Forum rules


Related:



Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Thu Mar 24, 2016 4:05 am 
Offline

Joined: Tue Aug 11, 2015 2:31 am
Posts: 21
The following are quoted from wiki

http://wiki.superfamicom.org/snes/show/Sprites

Quote:
The values are:

Xxxxxxxxx = X position of the sprite. Basically, consider this signed but see below.
yyyyyyyy = Y position of the sprite.^
cccccccc = First tile of the sprite.^^
N = Name table of the sprite. See below for the calculation of the VRAM address.
ppp = Palette of the sprite. The first palette index is 128+ppp*16.
oo = Sprite priority. See below for details.
h/v = Horizontal/Vertical flip flags.^^^
s = Sprite size flag. See below for details.
^Values 0-239 are on-screen. -63 through -1 are "off the top", so the bottom part of the sprite comes in at the top of the screen. Note that this implies a really big sprite can go off the bottom and come back in the top.




My questions are

1/ Since Y position of the sprite is only a 8 bit value, and the on screen display lines are either 224 or 239 lines. ( by setting of bit 2 in $2133 register )
Why the wiki said -63 is "off the top" ?
As -63 in 8 bit value is equal to 192 which is in the display range.
So my question is , Is it only value between ( 225/240 to 255 ) are values "off the top" ? so sprites of that value will show their lower parts on the top of the screen ?

2/ If I have a sprite of 64 pixel tall and I place it on display line 220, there are a few different scenerios
if my display mode is 224 lines
I should have only 4 lines of sprite display on the lower part of the screen
Do I have ( 220+64 - 256) = 28 lines on top of the screen ? ( this assumes the hardware is simple and uses just adder )
or Do I have ( 220+64 - 224) = 60 lines on top ? ( this assumes the hardware is intelligent and adjust for the blanking and line 0 rendering )
or Do I have ( 220+64 -224-1) = 59 lines ? ( this assumes the hardware did not adjust for line 0 rendering )
or Do I don't have any lines on top ? ( this assumes there are different logic to handle sprites in on screen region / negative region )

Thank you for any input


Top
 Profile  
 
PostPosted: Thu Mar 24, 2016 5:28 am 
Offline

Joined: Sun May 11, 2014 8:36 am
Posts: 77
Location: France
Quote:
So my question is , Is it only value between ( 225/240 to 255 ) are values "off the top" ? so sprites of that value will show their lower parts on the top of the screen ?

yes and no, for 225/240, depending on the size of your sprites.

To delete a sprite I put it on the position y $E0 (224 or -32) ,if your sprites are from 8x8 to 32x32
the 239 line is usable only for PAL release (otherwise NTSC loses much in VBlank)

For the sprite 64 pixels, I think the best is to delete the sprite with a position on x.
(But the 64pixel is difficult to use for a game).


Top
 Profile  
 
PostPosted: Thu Mar 24, 2016 5:26 pm 
Offline

Joined: Tue Aug 11, 2015 2:31 am
Posts: 21
Thank you Kannagi for his input.

On further thinking, does that really mean the OAM logic does not care about the Y position value ?

if you place the OAM at line 192 ( 0xC0 or -64 ) or beyond as stated in the wiki,
Physically, top part of the OAM is shown on the lower portion of the display screen,
and depending on the size of the OAM, if the OAM is very large, such that ( Vertical Size of OAM + Y Position ) > 256 then it will start wrapping from the top


Top
 Profile  
 
PostPosted: Thu Mar 24, 2016 6:20 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3192
Location: Mountain View, CA, USA
I don't understand what that wiki is trying to say either, honestly. I think they're trying to articulate something about the fact that sprites will "wrap" (visually and vertically).

The Y position of sprites ranges from 0-255 in the OAM, and the number is treated as an unsigned number.

I believe if you put an OBJ at a Y position where it could appear "off the bottom of the screen", the bottom portion of the sprite will end up "wrapping" back around to the top (i.e. the bottom portion of the sprite will appear at the top of the screen). When/when this happens is obviously influenced based upon the vertical resolution of the screen (224 (NTSC) vs. 239 (PAL) per bit 2 of $2133).

This is confirmed per nocash, section SNES PPU Sprites (OBJs). It's also (albeit oddly/kind of hidden) explained in the official developers manual.

If you want to hide a sprite, the generally recommended thing to do is to set its X position to something off-screen; X position is a 9-bit number where the MSB defines signedness or not (-255 to -1 are considered off-screen, and 0-255 are considered on-screen), and you shouldn't use a value of $100 (MSB set, Y position 0), but if you have to, be aware the sprite will be included/counted against in the 32-sprite-per-scanline limit.

I haven't fooled around with large (64x64) sprites, but I believe there isn't anything special about that with regards to what we're discussing.


Top
 Profile  
 
PostPosted: Thu Mar 24, 2016 6:55 pm 
Offline
User avatar

Joined: Mon Sep 15, 2014 4:35 pm
Posts: 3071
Location: Nacogdoches, Texas
koitsu wrote:
I haven't fooled around with large (64x64) sprites, but I believe there isn't anything special about that with regards to what we're discussing.

Weren't you just talking about wrapping? That's important to talk about in this case, because you can't "hide" a 64x64 sprite vertically because the range of possible y values isn't high enough. (The sprite will wrap around the top or bottom of the screen.) 64x64 sprites are right near useless though.


Top
 Profile  
 
PostPosted: Thu Mar 24, 2016 7:42 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3192
Location: Mountain View, CA, USA
Espozo wrote:
koitsu wrote:
I haven't fooled around with large (64x64) sprites, but I believe there isn't anything special about that with regards to what we're discussing.

Weren't you just talking about wrapping? That's important to talk about in this case, because you can't "hide" a 64x64 sprite vertically because the range of possible y values isn't high enough. (The sprite will wrap around the top or bottom of the screen.) 64x64 sprites are right near useless though.

koitsu wrote:
If you want to hide a sprite, the generally recommended thing to do is to set its X position to something off-screen; X position is a 9-bit number where the MSB defines signedness or not (-255 to -1 are considered off-screen, and 0-255 are considered on-screen), and you shouldn't use a value of $100 (MSB set, Y position 0), but if you have to, be aware the sprite will be included/counted against in the 32-sprite-per-scanline limit.


Top
 Profile  
 
PostPosted: Thu Mar 24, 2016 8:20 pm 
Offline
User avatar

Joined: Mon Sep 15, 2014 4:35 pm
Posts: 3071
Location: Nacogdoches, Texas
You can hide it if it's moving horizontally, but not vertically because it will wrap around, unless you want it to "disappear" at some point when it is moving vertically.


Top
 Profile  
 
PostPosted: Sun Mar 27, 2016 9:27 pm 
Offline

Joined: Tue Aug 11, 2015 2:31 am
Posts: 21
Thank you guys, that did explained all I need to know.. ( for now :) ).....


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 10 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