pcsx2 icon indicating copy to clipboard operation
pcsx2 copied to clipboard

[BUG] Sun flares shine through walls in hardware renderer.

Open y0nd0 opened this issue 4 years ago • 8 comments

Bug Description In hardware renderer the sun flares shine through walls. Tested in Need for Speed Most Wanted.

To Reproduce Play the game and make sure the sun is in front of you. Then you drive under a bridge. You'll see that the sun is hidden in sofware renderer mode, but still visible in hardware mode.

Expected behavior The sun should be behind the objects. As in the software renderer.

Settings I tried all possible settings in the GS plugin. Including hacks. It occurs in the default settings. It only disappears when switching to software mode. This means, it does not matter if using OpenGL or Direct3D. I just enabled the Half-pixel Offset to Normal (Vertex) to remove lines around the textures. But this has no effect to this issue. Let me know if you would like any specific settings. However, I'm sure there is only software / hardware settings to work around this issue. No special settings here.

Maybe you can explain the reason for this issue. That would be interesting. Hopefully we can find a solution. Using the Skipdraw Range hack should not be a solution. At that moment I found no value for it. Maybe we can reorder the layers. But maybe it's another issue. Not about the layers. Because when the sun is at the edge of the bridge, it is not only covered by the wall. It's a transition. Maybe a missing feature. Like raycast. See: pcsx2-nfsmw-issue-sun-sw-edge (Software Renderer. This is what is expected in hardware mode. But in HW mode, the sun is not covered.)

GS Window Screenshots

Actual (HW) Expected for HW (SW)
pcsx2-nfsmw-issue-sun-hw pcsx2-nfsmw-issue-sun-sw

videos-webm (Videos with more frames. GitHub does not yet support videos (no audio) ... Use e.g. VLC to view it. Or just the browser by drag'n'drop.)

System Info

  • PCSX2 Revision: v1.7.0-dev-675-g85c3ee823
  • OS: Windows 10 Pro 64-bit (v2004)
  • CPU: AMD Ryzen 5 3600 (6/12 Cores)
  • GPU: Nvidia GeForce RTX 2070 Super
  • RAM: 32GB
  • SSD: Yes

y0nd0 avatar Dec 11 '20 03:12 y0nd0

Can you provide a gs dump?

lightningterror avatar Dec 11 '20 05:12 lightningterror

Here is the GS dump: gsdump-frame-nfsmw-bug-sun-flare.zip Let me know if you need more stuff.

y0nd0 avatar Dec 11 '20 14:12 y0nd0

This game renders into the clut to update the alpha channel of the sun texture to decide if it's visible or not.

tadanokojin avatar Dec 11 '20 21:12 tadanokojin

Could the SwSpriteRenderer be of any help here?

iMineLink avatar Dec 11 '20 22:12 iMineLink

It's complicated. Clut is drawn sampling and rendering into a previous RT then copied.

So you need data from GPU.

tadanokojin avatar Dec 11 '20 22:12 tadanokojin

Nice. Btw the function already reads back from gpu memory by default. Obv, the data should be there and not cluttered in TC garbage.

iMineLink avatar Dec 11 '20 22:12 iMineLink

Tested in latest (nightly) version 1.7.3137. This bug still exists.

twoco avatar Jul 29 '22 18:07 twoco

Yup, not quite sure at the moment what this game does to occlude light. This bug appears in many games, but they all do it differently.

refractionpcsx2 avatar Jul 29 '22 18:07 refractionpcsx2