Project

General

Profile

Actions

Emulator Issues #9649

closed

Incorrectly calculated shadows in SpongeBob: BfBB

Added by scizzer12 over 8 years ago. Updated about 2 years ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Regression:
No
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
Fixed in:

Description

Game Name?

SpongeBob SquarePants: Battle for Bikini Bottom

Game ID? (right click the game in the game list, properties, info tab)

GQPE78

MD5 Hash? (right click the game in the game list, properties, info tab, MD5 Hash: Compute)

9e18f9a0032c4f3092945dc38a6517d3

What's the problem? Describe what went wrong.

Shadows are overly opaque and red + blue outline is sometimes present in the top left corner of the screen as well as some of the game edges.
I've combined bug reports because I'm fairly confident they're the same issue.

What steps will reproduce the problem?

Only present on internal resolutions greater than 1x or when Anti-aliasing is enabled:

Blue box in upper left appears when NOT looking at objects that require dynamic shading. The game is calculating shadows underneath a texture from the EFB (a copy of what's supposed to be there). The texture copy either doesn't cover the shadow projection properly, resulting in a blurred edge. Possibly a format discrepancy that's causing loss of information.

Shadows are red translucent triangles (matching the floor polygons) in a square surrounding spongebob.

With wireframe mode, projection hacks, or variable editing, you can manipulate the buffer up there, but never enough to remove it. See screenshots

Consistent test zone is the main menu where all degrees of all the issues happen.

Which versions of Dolphin did you test on? Does using an older version of Dolphin solve your issue? If yes, which versions of Dolphin used to work?

4-9000 - 5.0-88

What are your PC specifications? (CPU, GPU, Operating System, more)

Windows 7
Intel Xeon X5472
NVIDIA Quadro FX 4600

Windows 10
Intel i7 (first gen can't remember)
Nvidia GTX 540M

Is there any other relevant information? (e.g. logs, screenshots,
configuration files)

Included are several screenshots + FIFO replay. Settings are default everything.


Files

GQPE78-2.png (1.19 MB) GQPE78-2.png Main Menu with "Scaled EFB copy" off. Some shadows vanish. scizzer12, 06/28/2016 04:58 PM
GQPE78-1.png (1.23 MB) GQPE78-1.png Main Menu with both issues present scizzer12, 06/28/2016 04:58 PM
GQPE78-3.png (1.17 MB) GQPE78-3.png Main Menu with 1x iR. It should look like this, just in higher resolution. scizzer12, 06/28/2016 04:58 PM
GQPE78-4.png (1.45 MB) GQPE78-4.png (Un)Shadow boxes around characters. Blue outline is not present when other characters are on screen and the other characters do show up in the EFB copies when dumped scizzer12, 06/28/2016 04:58 PM
GQPE78-5.png (1.34 MB) GQPE78-5.png Blue box returns when spongebob is the only character's shadow being calculated scizzer12, 06/28/2016 04:58 PM
GQPE78-7.png (956 KB) GQPE78-7.png Top layer (which should have the blue box) removed by setting 803CD048 to 0 (from 256) scizzer12, 06/28/2016 04:58 PM
GQPE78-8.png (986 KB) GQPE78-8.png Top layer (which should NOT have the blue box) removed by setting 803CD048 to 0 scizzer12, 06/28/2016 04:58 PM
BfBB.dff (1.69 MB) BfBB.dff 3 frames of the main menu. Objects 72 and 77 seem to be the only ones accessing the EFB (at least copying to it) scizzer12, 06/28/2016 05:05 PM
GQPE78-2.png (1.18 MB) GQPE78-2.png 2 shadows being calculated (SB + jellyfish) scizzer12, 06/29/2016 08:02 PM
GQPE78-1.png (1.31 MB) GQPE78-1.png 1 shadow being calculated (spongebob) scizzer12, 06/29/2016 08:02 PM
GQPE78-3.png (1.16 MB) GQPE78-3.png 3 shadows being calculated (SB + JF + Mr Krabs) scizzer12, 06/29/2016 08:02 PM
GQPE78-4.png (1.41 MB) GQPE78-4.png low level iR fixes + shadow junk collector scizzer12, 06/29/2016 08:02 PM

Related issues 1 (0 open1 closed)

Related to Emulator - Emulator Issues #10551: Spongebob the Movie floor texture/shadow issues and transparent boxFixed

Actions
Actions #1

Updated by JMC4789 over 8 years ago

Some games don't support higher internal resolutions in Dolphin due to precision issues. This is one of them.

If there are no issues at 1x Internal Resolution then there's not likely anything that can be done. (see: Sonic Heroes/Shadow the Hedgehog for other examples of games that can't be rendered at higher resolutions properly.)

Actions #2

Updated by escape336 over 8 years ago

scizzer12 wrote:

With wireframe mode, projection hacks, or variable editing, you can manipulate the buffer up there, but never enough to remove it.

Tada!

043CD020 00000000
043CD048 00000000
043CD04C 00000000
04914D14 00000000

That's an AR code I made a little while back. Removes a bunch of shadow-based effects, but still removes the blue box at any resolution, with or without Scaled EFB Copies:

Actions #3

Updated by escape336 over 8 years ago

JMC4789 wrote:

Some games don't support higher internal resolutions in Dolphin due to precision issues. This is one of them.

If there are no issues at 1x Internal Resolution then there's not likely anything that can be done. (see: Sonic Heroes/Shadow the Hedgehog for other examples of games that can't be rendered at higher resolutions properly.)

The box is actually still there at all resolutions, but it's just covered up at all times by an EFB copy of the area of the screen behind it (why they didn't just remove the box, we may never know.)

Actions #4

Updated by escape336 over 8 years ago

Also, the box is not present in the PS2 or Xbox versions, for whatever reason.

Actions #5

Updated by JMC4789 over 8 years ago

Should I close this issue then? Or is there anything else to say about it?

Actions #6

Updated by scizzer12 over 8 years ago

JMC4789 wrote:

Should I close this issue then? Or is there anything else to say about it?

I don't know if removing shadows is really a solution.
I mean, I wrote an AR code that stretches the EFB copy 1 extra pixel (and still keeps shadows) and I wouldn't call that a solution. It leaves a seam because the textures don't line up properly but as soon as I find the X,Y offset, that shouldn't be an issue.

If we accept there is no solution and never will be (like moving the EFB copy layer back behind everything, fixing the edge blending, increasing the calculation size of the ground shadows so large that nobody can see them, etc) then I guess we could close it, but I feel like that'd be giving up. This issue is also present in the sequel (the spongebob movie game) and a solution could set a precedent for similar solutions with rounding issues in other games.

Actions #7

Updated by escape336 over 8 years ago

JMC4789 wrote:

Should I close this issue then? Or is there anything else to say about it?

This doesn't seem to be an issue with emulation, but an inherent issue with the scaling of IR/EFB copies. As I said, the box is in fact there on console, but you can't see it.

Updated by scizzer12 over 8 years ago

So I found something(s) interesting.

When I changed one of the offset values I noticed that the box in the top is correct only when there's more than one shadow being calculated. Since the rounding error seems to be because the game doesn't place every calculation box at the same exact location. Look at screenshots 1-3. They're all offset by a lot. Normally this is only by a pixel or a subpixel for every object.

I also made something temporary that moves the graphical stripe to the top-left where it's significantly less noticeable. (Screenshot 4)
========Current fix=======
$1.5x & 2x iR
043CD048 437F8000 <-EFB overlay to 255.5px
043CD04C 3A562BF1 <-EFB overlay scale multiplier
04914D14 000000F8 <-Shadow calc box size X to 248
04914D18 000000F8 <-Shadow calc box size y to 248
04914D48 00000000 <-Shadow texture to grey

$Other iR (Not perfect. Just moves the seam to the edge of the screen)
043CD048 43800000 <-EFB overlay to 255.5px
043CD04C 00000000 <-EFB overlay scale multiplier (couldn't find one without rounding errors)
04914D14 000000F8 <-Shadow calc box size X to 248
04914D18 000000F8 <-Shadow calc box size y to 248
04914D48 00000000 <-Shadow texture to grey

Also something to reduce shadow artifacts (at the expense of quality)
$Shadow simplifier
043CD054 45800000 <-Shadow Display size (8x smaller)
043CD01C BD800000 <-Shadow Scale (8x larger)
043CD020 43000000 <-Shadow opacity (50%)

Actions #9

Updated by JMC4789 over 8 years ago

Maybe put the codes on the wiki and then I'll close this issue :)

Actions #10

Updated by iwubcode almost 8 years ago

Please see my fix here: https://github.com/dolphin-emu/dolphin/pull/4715 ; turn on "Vertex Rounding"!

Actions #11

Updated by JMC4789 over 7 years ago

  • Status changed from New to Fixed

This is (mostly )fixed by enabling the Vertex Rounding Hack OR using 1x IR... pick your poison.

Actions #12

Updated by pokechu22 about 2 years ago

  • Related to Emulator Issues #10551: Spongebob the Movie floor texture/shadow issues and transparent box added
Actions

Also available in: Atom PDF