doitsujin / dxvk

Vulkan-based implementation of D3D8, 9, 10 and 11 for Linux / Wine
zlib License
12.76k stars 822 forks source link

[d3d9] The Last Remnant - shadows #1867

Open liandris opened 3 years ago

liandris commented 3 years ago

This issue is not dxvk-specific, and not Linux-specific. Nevertheless I wanted to ask if something can be done about it using dxvk functionality, or if developers know something about this.

Video: https://gfycat.com/violetgraciousamazonparrot Shadows from character models jitter when camera is at certain angles. Also (not shown on video) the rectangle of shadow from the main character and misc shadows around main character model tend to jitter together with the shadow on ground.

Possibly related, similar issue in Unreal Tournament 3: https://www.youtube.com/watch?v=HDDquMvljPI It just shows the shadowing issues around the character model. The Last Remnant is UE3 based, but it seems to be the only game (that I know) where issues with shadows on ground are this apparent.

It's a long standing problem for this game on AMD cards. Maybe it's really just an engine build issue, or specific dynamic shadows implementation issue. Nvidia driver doesn't have this problem, but I'm certain it's not because they render stuff "better" - I've checked some bits of their driver and it appears to contain exact written description of this problem for this game, possibly along with compatibility directives. I also tried to make the game work without that compatibility layer of Nvidia drivers to confirm it's a game issue, but that failed for now (it just crashes). However, a friend with Nvidia GPU told me that he doesn't see these issues when using dxvk on Windows. Which I can't confirm, but if true it would mean that Nvidia's application compatibility profiles are API-agnostic, and I didn't expect that.

I've tried using every available d3d9-related option in dxvk.conf and that didn't change anything. No engine .ini configuration seem to affect it either. By messing with game engine scripts, I could disable static and dynamic shadows, but it doesn't help. Seeing this issue both under dxvk and without it makes me think that's how it should work due to engine issues. So it likely affects both AMD and Nvidia cards on Linux too.

Any help would be appreciated. Of course, sorry for adding an issue that is not related to dxvk bugs.

Software information

The Last Remnant Settings are not important, but shadows should be enabled.

System information

Apitrace file(s)

https://mega.nz/file/suhUGJLT#DHqnYb2u8dUTkZh7gWhWdrjBRgtedBqYrW0DoH7S1JI

Log files

doitsujin commented 3 years ago

Which I can't confirm, but if true it would mean that Nvidia's application compatibility profiles are API-agnostic, and I didn't expect that.

It's more likely that the engine uses a different code path depending on GPU vendors, and the Nvidia one just happens to work. You could try setting d3d9.customVendorId = 10de dxvk.conf as described here and see if that works around the issue.

There's a few other D3D9-specific options that are known to affect how some games operate as well, might be worth playing around with those.

liandris commented 3 years ago

It's more likely that the engine uses a different code path depending on GPU vendors, and the Nvidia one just happens to work. You could try setting d3d9.customVendorId = 10de dxvk.conf as described here and see if that works around the issue.

There's a few other D3D9-specific options that are known to affect how some games operate as well, might be worth playing around with those.

Thank you for attention.

Maybe I could do a bit more testing if my Nvidia card was Vulkan-capable.

I've tried d3d9.customVendorId = 10de and it didn't change anything. Also, I confirm that the game .exe contains at least one place where it changes the code path if you feed 10de as a vendor ID. Then it also checks device ID against a certain list. Thing is, that place doesn't seem to affect shadow rendering. Tried feeding the IDs of my Nvidia card (it's not on that list) and it also didn't change anything. Picking device ID from that predefined list also showed no results.

I also already tried enabling every d3d9-related option in dxvk.conf one by one (making them different from their default values). Didn't help with the shadows.

pchome commented 3 years ago

@liandris

Also, I confirm that the game .exe contains at least one place where it changes the code path if you feed 10de as a vendor ID.

The Last Remnant is UE3 based

AFAIK, UE3 based games uses "profiles" for some defaults, there is Engine/Config/BaseCompat.ini which describes what settings will be used for what CPU/GPU.

... ;0 indicates unsupported. -1 indicates untested. Most laptops and Quadros have not been tested ; 1=VeryLow, 2=Low, 3=Medium, 4=High, 5=VeryHigh ...

And a game itself can extend/override it's settings based on this data, eg. I can see this in BorderlandsPreSequel/WillowGame/Config/DefaultCompat.ini.

But usually user can override most settings in user config files, so if you know another UE3 game where shadows looks ok then try to use it's *shadow*= settings.

For more info see: https://www.pcgamingwiki.com/wiki/The_Last_Remnant https://www.pcgamingwiki.com/wiki/Engine:Unreal_Engine_3 https://steamcommunity.com/sharedfiles/filedetails/?id=484128370

liandris commented 3 years ago

@pchome

The game folder doesn't contain BaseCompat.ini or DefaultCompat.ini, and according to ProcessMonitor it doesn't try to read such files.

As for the links you provided, I already checked multiple guides for this game and most of them suggest very similar stuff. Many options I've changed according to them, plus more lines that were not mentioned or poorly documented that I've experimented with. Not sure what you wanted to point at with Batman Tweak Tool guide, since it contains game-specific fixes. I wish it was possible to fix this issue by changing settings, but after all it doesn't look like it's possible. It's not even possible to modify the default FOV without editing actual compiled .u scripts. (Well, changing FOV is possible with bindable "FOV" command but it doesn't work well since its effect is always global, which breaks some scenes and menus)

pchome commented 3 years ago

@liandris

Not sure what you wanted to point at with Batman Tweak Tool guide, since it contains game-specific fixes.

UE3 settings (and bugs) are usually common, and this guide may have some details. You also could check source code, maybe it'll help, especially if there are descriptions why they changing specific settings. https://github.com/Kaldaien/BMT/search?q=shadow

liandris commented 3 years ago

@pchome

UE3 settings (and bugs) are usually common, and this guide may have some details.

The shadow flickering bug does seem to be something else, and so far I've yet to see any guide or tool that would attempt to fix it, in any game. Basically, it may not even be considered a bug - Nvidia quietly "fixed" it for their cards and thus it did not receive enough attention from anyone, including game developers.
It may not even be directly related to shadows. Other systems might be at play, like light sources and camera.

You also could check source code, maybe it'll help, especially if there are descriptions why they changing specific settings.

What I see in the source code suggests the tool only operates with predefined collections of .ini settings to tune quality and performance and does not attempt to fix any bugs. I've already tried playing with just about any setting I could find that could be related to shadows. And from experience with what I've tried so far, the game will ignore any extra settings not found in original files (from different UE3-based games).

liandris commented 3 years ago

I was now able to run the game on Nvidia card through dgVoodoo's d3d9 layer, and I've made all I could think of to ensure that Nvidia driver doesn't identify the game title and thus does not apply any compatibility modes. The shadow rendering issue did not appear. (It still appears when using dgVoodoo with AMD card)

Some possibilities I could think of:

I'm more puzzled now. Perhaps someone could test the game in Linux environment on their hardware and share results?

bedwardly-down commented 3 years ago

@liandris I think it’s an Intel bug in general. Playing the game on Windows on my Asus laptop with an Intel HD graphics chip, I ran into some similar shadow rendering issues last time I played. I kind of wish the UE4 remastered release came to PC.

liandris commented 2 years ago

With the arrival of Steam Deck with SteamOS, I expect more users will find this issue on AMD hardware. I'd like to ask if anyone is able to check for this issue on Linux/Proton.

Blisto91 commented 2 years ago

I can confirm i see the issue when replaying the trace on my AMD R9 380 linux and mesa git. Haven't found any config options that seem to affect it.

Blisto91 commented 1 year ago

If it helps with debugging the issue then it also reproduces ingame in the free demo https://www.pcgamingwiki.com/wiki/The_Last_Remnant#Availability Easiest is to go to town square and then you can see the shaky shadows on the npc's and protagonist at certain angles. If one pays close attention one can also see some thin shadow lines pointing out from the protagonist at certain angles so the issue isn't only that they shake around.