Project

General

Profile

Emulator Issues #9712

Super Mario Galaxy 2 - Fog renders at incorrect distances based on Internal Resolution setting

Added by philcsf about 4 years ago. Updated almost 3 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:
5.0-5745

Description

Game Name?

Super Mario Galaxy 2

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

SB4P01

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

3bab1232fddf34e6ba4ca315066bb8d1

What's the problem? Describe what went wrong.

Fog renders at an incorrect distance when increasing the Internal Resolution setting in the options. The higher the internal resolution setting, the further away the fog renders.

Screenshot (running at 6x Native for 4K): http://i.imgur.com/yczld2f.jpg
Console: http://i.imgur.com/fTBBJvG.jpg
Video: https://www.youtube.com/watch?v=60FrYi4cTUs

What steps will reproduce the problem?

Complete the first level, and observe skybox whilst on the ship afterwards. Fog will be rendering at an incorrect distance based on Internal Resolution setting.

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?

5.0, running both DX11 and DX12 back ends (video was using DX11).

4.0-3950 - https://www.youtube.com/watch?v=UouyVg70kRM - http://i.imgur.com/Tp4NQys.jpg
Fog is rendering further away than console screenshot, but not as far as when I was running 6x (so they were probably running 3x for 1080p?)

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

Intel i5-3750K (running at 3.8GHz)
NVIDIA Geforce GTX 1080 (Driver 368.81)
Windows 10

smg2-menu-fog.dff (1.92 MB) smg2-menu-fog.dff ornox, 09/02/2016 03:30 PM

History

#1 Updated by Disorderly about 4 years ago

Does this happen in OpenGL?

#2 Updated by philcsf about 4 years ago

Yes, this also happens in OpenGL. Found a more obvious case - The save select screen. At higher internal resolutions, the fog fades and the background clouds move further away.

Screenshots showing OpenGL in various internal resolutions, 8x is essentially just blue sky behind the foreground clouds: http://imgur.com/a/eVZix

#3 Updated by JMC4789 about 4 years ago

This is one of those things where the game uses resolution for calculations; turn off scaled EFB if you want to fix it. If you can confirm that fixes it, I'll be closing this issue.

#4 Updated by philcsf about 4 years ago

Hello JMC4789. Toggling the 'Scaled EFB Copy' option seems to have no effect on the issue, and still renders differently compared to native internal resolution.

8x Native, Scaled EFB Copy ON: http://i.imgur.com/q1KePL0.jpg
8x Native, Scaled EFB Copy OFF: http://i.imgur.com/dtTWCFX.jpg
Native: http://i.imgur.com/FL00OZ0.jpg

#5 Updated by JMC4789 about 4 years ago

If it's not Scaled EFB I don't know. I remember it being related to Depth Matrix Shaders, but, honestly, I'm guessing if you want it to render more accurately, you're going to need to play at 1x IR in most cases.

#6 Updated by JMC4789 about 4 years ago

  • Status changed from New to Accepted

Reproduced in a simple homebrew test. Something is weird.

#7 Updated by ornox about 4 years ago

Here's a 3 frame fifo log

#8 Updated by iwubcode over 3 years ago

It is worth noting that this also happens with various types of anisotropic filtering turned on. Because of this, I think it is similar to Issue #9620

#9 Updated by iwubcode over 3 years ago

I tried to investigate this today but am still a novice at debugging Dolphin so haven't really found much. I was using Renderdoc and tried to compare textures/vertex-fragment shaders but didn't see anything odd.

JMC4789 wrote:

Reproduced in a simple homebrew test. Something is weird.

Would this be something you should add to https://github.com/dolphin-emu/hwtests ?

#10 Updated by iwubcode over 3 years ago

After talking to degasus and hthh, we believe the issue is related to mip levels. We didn't come to a good conclusive answer on whether there was a workaround but the proposed issue makes sense, here's there comments for preservation:

dagasus

Higher resolutions triggers higher LOD levels
could calculate the mipmap level based on native resolutions, but this would bur almost every texture effect
we use the automatic mip level, just as the hardware itself. But when we scale the framebuffer, we choose a wrong mipmap. This is usually a good enhancement through

hthh

I think I understand it a bit differently: you always have five mipmap levels (32, 16, 8, 4, 2, 1)
the highest resolution level (32) is completely transparent, so the fog clears when you are close
but lower resolutions have opaque fog

Thank you guys for your information, I didn't even think of mip levels when thinking about this problem!

#11 Updated by crudelios over 3 years ago

iwubcode wrote:

After talking to degasus and hthh, we believe the issue is related to mip levels. We didn't come to a good conclusive answer on whether there was a workaround but the proposed issue makes sense, here's there comments for preservation:

dagasus

Higher resolutions triggers higher LOD levels
could calculate the mipmap level based on native resolutions, but this would bur almost every texture effect
we use the automatic mip level, just as the hardware itself. But when we scale the framebuffer, we choose a wrong mipmap. This is usually a good enhancement through

hthh

I think I understand it a bit differently: you always have five mipmap levels (32, 16, 8, 4, 2, 1)
the highest resolution level (32) is completely transparent, so the fog clears when you are close
but lower resolutions have opaque fog

Thank you guys for your information, I didn't even think of mip levels when thinking about this problem!

I was fiddling with Dolphin Ishiiruka's graphics settings and found out something strange.

As you may know, Ishiiruka has some extra graphical options that don't exist in the master branch.

What I found out is that if you enable texture scaling, the fog's size will change. For example, if you set the internal resolution to 4x and the texture scaling also to 4x (any scaling mode will do, I used XBRZ), the white fog will be rendered correctly. It will work as long as the internal resolution multiplier is the same as the texture scaling multiplier.

Curiously enough, if you set the internal resolution to native and enable texture scaling (setting any multiplier), the fog will be too big.

Also, by selecting "Disable Texture Filtering", the fog disappears entirely.

I know Ishiiruka is not the official emulator, but perhaps this behaviour gives a hint to what is going on?

#12 Updated by iwubcode over 3 years ago

crudelios wrote:

I was fiddling with Dolphin Ishiiruka's graphics settings and found out something strange.

As you may know, Ishiiruka has some extra graphical options that don't exist in the master branch.

What I found out is that if you enable texture scaling, the fog's size will change. For example, if you set the internal resolution to 4x and the texture scaling also to 4x (any scaling mode will do, I used XBRZ), the white fog will be rendered correctly. It will work as long as the internal resolution multiplier is the same as the texture scaling multiplier.

Curiously enough, if you set the internal resolution to native and enable texture scaling (setting any multiplier), the fog will be too big.

Also, by selecting "Disable Texture Filtering", the fog disappears entirely.

I know Ishiiruka is not the official emulator, but perhaps this behaviour gives a hint to what is going on?

I think that mostly helps confirm suspicion but is a good workaround for now.

Also worth noting that Zelda Twilight Princess's "sunrays" is also due to this issue (see https://wiki.dolphin-emu.org/index.php?title=The_Legend_of_Zelda:_Twilight_Princess_(GC) )

#13 Updated by JosJuice almost 3 years ago

  • Fixed in set to 5.0-5745
  • Status changed from Accepted to Fixed

I haven't tested it myself, but this should be fixed by https://dolphin-emu.org/download/dev/e29cd19f731d11bfa8deefebfd2a867af4f2e348/

Also available in: Atom PDF