dxvk icon indicating copy to clipboard operation
dxvk copied to clipboard

d3d11: LEGO Worlds shadow flickering

Open Blisto91 opened this issue 2 years ago • 1 comments

In Lego Worlds d3d11 sometimes the ground can flicker depending on camera angle looking like a flickering shadow. See https://github.com/ValveSoftware/Proton/issues/1345#issuecomment-1805369641 for video example

Issue does not show with wined3d

Software information

LEGO Worlds d3d11 Shadow quality at Medium or High

System information

  • GPU: RX 6800
  • Driver: mesa 23.2.1, mesa main & amdvlk 2024.Q4.1
  • Wine version: Proton Experimental
  • DXVK version: 1.3.4 - master

Apitrace file(s)

https://drive.proton.me/urls/CG6P7J55XC#BiYjYbfZYmgw

Log files

LEGO_Worlds_DX11.EXE_dxgi.log LEGO_Worlds_DX11.EXE_d3d11.log

Blisto91 avatar Nov 14 '23 09:11 Blisto91

Debugged this for a bit, this appears to be an inaccuracy with hardware Z interpolation with huge (and I'm talking insanely huge) polygons.

The game renders a box with post-projection coordinates in the range of 1e8...1e9, i.e. literally hundreds of millions of times larger than the viewport, with the w coordinate being 1.0 so there is no perspective correction or scaling at all. Sometimes, these triangles actually intersect the viewport at a relevant depth range, but the interpolated depth value that AMD hardware uses to perform the depth test is all over the place. This works fine as-is on Nvidia.

TL;DR no idea how to work around this. Exporting gl_FragDepth = position.z from the fragment shader technically works in this specific case, but doing that is just straight-up not a viable fix.

doitsujin avatar Nov 16 '23 20:11 doitsujin