HansKristian-Work / vkd3d-proton

Fork of VKD3D. Development branches for Proton's Direct3D 12 implementation.
GNU Lesser General Public License v2.1
1.91k stars 199 forks source link

tlou1 god rays can go through buildings #1518

Closed Blisto91 closed 1 year ago

Blisto91 commented 1 year ago

In The Last of Us Part 1 god rays can sometimes be seen going through buildings. This does not happen in the native Windows version, but does happen with vkd3d-proton on Windows.

Screenshot ![image](https://user-images.githubusercontent.com/47954800/232550145-8a68a21b-0397-4686-bfec-d6c086457767.png)

Software information

In The Last of Us Part 1 Ultra preset. Haven't tested others yet.

System information

Log files

steam-1888930.tar.gz

Save game

Just look at the buildings to the left when spawning in SAVEFILE00.tar.gz

Taken from compatdata/1888930/pfx/drive_c/users/steamuser/Saved Games/The Last of Us Part I/users/<user-id>/savedata/

K0bin commented 1 year ago

I can't reproduce this on an Nvidia GPU. On Linux, it renders correctly and promptly hangs.

On Windows (with vkd3d-Proton), it works fine.

adolfintel commented 1 year ago

I can confirm this on my 6900xt, in some areas god rays are visible through walls. I can make a trace with renderdoc if you want. This happens regardless of graphics settings, using the latest mesa (23.2 built from source today)

Blisto91 commented 1 year ago

Thanks for the offer. One of the devs is already diving in to the issue so that won't be needed 🙂

doitsujin commented 1 year ago

Game bug, will need some sort of shader-based workaround.

adolfintel commented 1 year ago

I just tested the current master and the issue is still present and in the same spots (6900xt), can you make sure the shader hash didn't change with version 1.0.3? @doitsujin

Untitled

mbriar commented 1 year ago

Also possible it uses a slightly different shader for this in different parts of the game? So maybe add another save game for areas where you can still repro this. And if the hashes indeed changed between versions, then 1.0.3 will probably also be obsolete soon :D https://twitter.com/Naughty_Dog/status/1649526833678020609?cxt=HHwWgsDTjc36peQtAAAA

Blisto91 commented 1 year ago

This issue was tested with 1.0.3 how did you test master? Just used proton bleeding edge?

Note the game itself have a bug with rays going through buildings also in the same spots, it just wasn't as pronounced as the vkd3d-proton stuff added on top. The devs have or will notify the game devs of this afaik.

adolfintel commented 1 year ago

Here's a saved game to see if it uses a different shader. It's pretty early into the game, right after you encounter the first zombies. SAVEFILE0A.zip

As for how I tested it, I built it from source and installed it in the game's wineprefix.

Blisto91 commented 1 year ago

Thanks. I will check it out.

mbriar commented 1 year ago

Proton will override any dxvk or vkd3d-proton dlls you install to the wine prefix on launch, so you probably didn't test master. Either overwrite the vkd3d-proton dll in the proton files, or copy the d3d12.dll and d3d12core.dll next to the .exe. Or just use proton experimental bleeding edge.

Blisto91 commented 1 year ago

Right. What mbriar said. Didn't catch that one.

I'd advise trying bleeding edge or overwriting Protons own files in common. Putting files next to the exe can be iffy together with Proton/wine depending on the game.

Blisto91 commented 1 year ago

Thanks for the save. I see the issue and also that it isn't present in the native game (couldn't get vkd3d-proton working on Windows again this time for extra test)

doitsujin commented 1 year ago

Reopening because apparently the fix doesn't work. Not sure what to do here since this looks like the same bug.

adolfintel commented 1 year ago

@doitsujin do you want a trace this time?

adolfintel commented 1 year ago

Check this out.

I changed the if at https://github.com/HansKristian-Work/vkd3d-proton/blob/c74ffa5427eb5ff50f9047a1825dcecfd1cfe5dc/libs/vkd3d-shader/dxil.c#L969, removing the first part of the condition so that the quirk would apply to all shaders that use a group size >32, the problem is gone, you were on the right track.

So either the game has multiple shaders that need this quirk or the shader has was changed with the patch.

Performance and stability don't seem to be affected by me forcing this quirk on all shaders so maybe you could add the quirk for tlou-i.exe in general?

Untitled

HansKristian-Work commented 1 year ago

I guess we'll have to dump the shaders and see how widespread the problem is. We might be able to do a more directed workaround by analyzing how ballot results are used perhaps ...

adolfintel commented 1 year ago

Is there any way I can help?

HansKristian-Work commented 1 year ago

Confirming the global wave32 hack worked was help enough I think.

Blisto91 commented 1 year ago

Just a quick note for future visibility. Issue visually appears in the spot above when "Directional Shadow Distance" is set above Low

adolfintel commented 1 year ago

I just did some more testing and it looks like applying the wave32 workaround globally for tlou-i.exe also fixes the sun shadows that have a "blocky screenspace effect" in some areas (mostly interiors) so I guess there are many shaders in this game that need this workaround.

Performance doesn't seem to be affected and the game doesn't crash so I'm opening a PR with the workaround applied properly to the exe instead of changing that condition.

Sylvanas-1977 commented 4 months ago

This issue also happens on Windows with just Directx12 so whoever suggested it does not happen on Windows i assume you meant when using vk3D on Windows, not sure if this was fixed in VK3D tho, i am on a 7900 XTX tho.

Blisto91 commented 4 months ago

Yes it also happens on Windows it was later found. The issue here was that it was much worse with vkd3d-proton

Sylvanas-1977 commented 4 months ago

Yes it also happens on Windows it was later found. The issue here was that it was much worse with vkd3d-proton

Not sure but this is how it looks like in WIndows on certain spots https://imgur.com/VYoVcXa https://imgur.com/F66etpm Happens in more locations ofcourse these are on Directx12

Anyway was it fixed in vk3D ?

Blisto91 commented 4 months ago

It was fixed so it looks the same as on native Windows with vkd3d-proton yes.

Sylvanas-1977 commented 4 months ago

if VK3D managed to fix this perhaps naughty dog can fix the issue them self as well might be better anyway, i have had success getting some shader related issues fixed. Not sure if i reported this issue yet to naughty dog them self i probably did, its not like i keep a log in my head on what issues i report or have.