Display exception occurs when multiple sprites overlap

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
GZYangKui
Posts: 46
Joined: Wed Dec 21, 2022 6:54 am

Display exception occurs when multiple sprites overlap

Post by GZYangKui »

When multiple sprites overlap, an exception will appear. According to my understanding, the priority of sprites should be determined by the order of sprites. For example, if sprite No. 1 and sprite No. 3 overlap at x=30, then I should display the pixels of sprite No. 1 and ignore the pixels of sprite No. 3. At present, I do not know if I understand correctly?

https://user-images.githubusercontent.c ... f9ecc4.mp4
Last edited by GZYangKui on Sun Jan 08, 2023 8:12 am, edited 1 time in total.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Display exception occurs when multiple sprites overlap

Post by tepples »

My web browser could not play the video.

This video is encoded at YUV444, which contains full chroma (color) data for each pixel. Many web browsers are not capable of playing YUV444 video. For patent licensing reasons, many web browsers use a licensed decoder that happens to be capable only of YUV420, where chroma data is downsampled by a factor of two in both X and Y directions. This means there are four luma (brightness) samples for each chroma samples. Usually this is done to reduce the size of data to encode, as the human visual system is less sensitive to fine chroma detail than to fine luma detail.

I tried playing the video in VLC instead, and it appears corrupt. The video is entirely black. The audio cuts in and out, is distorted (overdriven) when it is playing, and seems to vary between correct pitch and sharp by a fraction of a semitone over the course of the video.
GZYangKui
Posts: 46
Joined: Wed Dec 21, 2022 6:54 am

Re: Display exception occurs when multiple sprites overlap

Post by GZYangKui »

tepples wrote: Sun Jan 08, 2023 7:50 am My web browser could not play the video.

This video is encoded at YUV444, which contains full chroma (color) data for each pixel. Many web browsers are not capable of playing YUV444 video. For patent licensing reasons, many web browsers use a licensed decoder that happens to be capable only of YUV420, where chroma data is downsampled by a factor of two in both X and Y directions. This means there are four luma (brightness) samples for each chroma samples. Usually this is done to reduce the size of data to encode, as the human visual system is less sensitive to fine chroma detail than to fine luma detail.

I tried playing the video in VLC instead, and it appears corrupt. The video is entirely black. The audio cuts in and out, is distorted (overdriven) when it is playing, and seems to vary between correct pitch and sharp by a fraction of a semitone over the course of the video.
Thanks for your reply. I have uploaded the video again
User avatar
Dwedit
Posts: 4924
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: Display exception occurs when multiple sprites overlap

Post by Dwedit »

It appears that you are allowing transparent sprite pixels to have priority, which is incorrect. The transparent pixels should be ignored, and you don't give a priority to a pixel until you encounter a non-transparent pixel.

Note that a pixel of a sprite intended to be drawn *behind a background* will still take priority, even if the background is drawn over it. This is how the sprite masking effects from Super Mario 3 work.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
Post Reply