Page 1 of 1

So when is fog getting added?

Posted: Sun Jan 19, 2014 11:36 pm
by Intymyt
Just wondering.

Re: So when is fog getting added?

Posted: Mon Jan 20, 2014 2:04 am
by Exophase
I had some code a while ago, but it's not optimized and it needs some more changes to other parts of the renderer to really handle things correctly. It's hard even finding a lot of parts in games that use it, and it can be pretty subtle. For example, Luigi's Mansion in Mario Kart uses it to fade the background towards a dark blue.

What are you thinking of that uses it? It's possible that it actually doesn't, and missing/bad graphics could be due to some other bug.

Re: So when is fog getting added?

Posted: Mon Jan 20, 2014 11:51 am
by Intymyt
Well I know in Pokemon Platinum and Pokemon Black 2 there are Gyms that have a pitch black effect (one of them you're given a flashlight, the other one has lights that turn on when you approach their platforms) but instead everything is revealed so there's nothing hidden.

Re: So when is fog getting added?

Posted: Mon Jan 20, 2014 1:52 pm
by Intymyt
Forgot to add it also affects areas that require the moves "Flash" and "Defog"

Re: So when is fog getting added?

Posted: Mon Jan 20, 2014 6:36 pm
by Exophase
If you don't mind uploading savestates for some or all of these things I can check if they're really impacted by fog or if there's something else wrong.

Re: So when is fog getting added?

Posted: Mon Jan 20, 2014 10:07 pm
by beansta
I have an ingame save for pokemon soul silver here that is at the place that demonstrates this fog error. I would add a screenshot too but its too big for the file size limit.

Re: So when is fog getting added?

Posted: Mon Jan 20, 2014 11:01 pm
by Intymyt
Pokemon Black 2 (U).rar
(10.8KiB)Downloaded 468 times
Note the black circles on the ground. These are the areas that should be lit up, while everywhere else should be dark.

Re: So when is fog getting added?

Posted: Tue Jan 21, 2014 3:31 am
by Exophase
Intymyt wrote:
Pokemon Black 2 (U).rar
Note the black circles on the ground. These are the areas that should be lit up, while everywhere else should be dark.
Thanks, both of you.

I've looked into this and confirmed that the visible areas are indeed missing due to unemulated fog. If I disable fogging in desmume I get the same artifact. However, it's not using the actual fogging process that's used here, but the DS's fog masking ability. The game is probably initializing the depth buffer with the fog bit in a way that disables some of the rendering. Unfortunately, right now even my slow code doesn't actually emulate the per-pixel fog enable bit, so I have to work that in somehow before I can get this functionality.

I'll try to get to this in the near future.