It is currently Mon Feb 19, 2018 2:48 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Mon Dec 25, 2017 5:32 am 
Offline

Joined: Tue Apr 11, 2006 4:08 am
Posts: 260
Playing Mystery World Dizzy, I noticed something I had not seen before (or did not pay attention). It's about hiding the object (sprites) behind the background (for example, a large pillar at the beginning of the game).
It is known that bit5 in the OAM attribute is responsible for displaying sprites behind or in front of background elements/tiles. Only from what I know, it works on all the elements of the background at the same time.
I wonder how it was done that the character / sprite smoothly enters behind pilar, but at the same time being partially visible on a completely different part of the background (front of the wall).

I am very curious how it was done.


Attachments:
dizz.jpg
dizz.jpg [ 98.17 KiB | Viewed 543 times ]
Top
 Profile  
 
PostPosted: Mon Dec 25, 2017 5:56 am 
Offline
User avatar

Joined: Thu Mar 31, 2016 11:15 am
Posts: 275
If two sprites are overlapping, the overlapping pixels are determined by only one of them: the sprite lowest in OAM. If bit 5 of the lowest sprite is set, the overlapping pixels will be rendered behind the background, regardless of the other sprite's attributes.

In your image, I'm guessing that opaque sprites are being drawn where the columns are, and that these sprites have bit 5 set and are lower in OAM than the sprites of Dizzy. The overlap of these sprites with Dizzy will render as the background, thus creating the effect you see.


Top
 Profile  
 
PostPosted: Mon Dec 25, 2017 8:17 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10288
Location: Rio de Janeiro - Brazil
Yup, high priority (i.e. low OAM index) opaque sprites with the "behind the background" bit set, positioned along the edge of the column. If other sprites try to overlap those, they lose the battle because their OAM indices are higher, but then, when it's time to draw the winning high priority sprites, no sprite pixels are drawn because they are "behind the background".

This trick allows you to make sprite masks in whatever shape you need, as long as you don't blow your sprites-per-scanline budget.


Top
 Profile  
 
PostPosted: Tue Dec 26, 2017 3:49 am 
Offline

Joined: Tue Apr 11, 2006 4:08 am
Posts: 260
Ok, everything is clear. Thanks. I did not notice that at the moment when the Dizzy touches the pillar, additional sprites are placed on the edge of the pillar.

A similar effect is in Wonderland Dizzy, but there visible Sprite overflow reveals the use of additional sprites to make the character hide behind the wall.


Attachments:
dizzsproverflow.png
dizzsproverflow.png [ 50.2 KiB | Viewed 399 times ]
dizzspr.jpg
dizzspr.jpg [ 205.88 KiB | Viewed 401 times ]
Top
 Profile  
 
PostPosted: Tue Dec 26, 2017 8:30 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10288
Location: Rio de Janeiro - Brazil
Another game that uses this trick is Nightshade. The very first room in the game has a pillar in the foreground that allows you to observe this effect.


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

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