Bug 109599 - small shadows are not drawn in various games (shadow map bias issue?)
Summary: small shadows are not drawn in various games (shadow map bias issue?)
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Vulkan/radeon (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
Depends on:
Reported: 2019-02-09 16:28 UTC by tempel.julian
Modified: 2019-05-13 20:40 UTC (History)
0 users

See Also:
i915 platform:
i915 features:

broken hedges (5.19 MB, image/png)
2019-02-14 13:35 UTC, tempel.julian
new renderdoc capture part 1 (180.00 MB, application/x-7z-compressed)
2019-03-13 15:04 UTC, tempel.julian
new renderdoc capture part 2 (180.00 MB, application/octet-stream)
2019-03-13 15:15 UTC, tempel.julian
new renderdoc capture part 3 (148.38 MB, application/octet-stream)
2019-03-13 15:18 UTC, tempel.julian
hitman 2 renderdoc capture 1 (190.00 MB, application/x-7z-compressed)
2019-04-29 17:27 UTC, tempel.julian
hitman 2 renderdoc capture 2 (190.00 MB, application/octet-stream)
2019-04-29 17:32 UTC, tempel.julian
hitman 2 renderdoc capture 3 (190.00 MB, application/octet-stream)
2019-04-29 17:39 UTC, tempel.julian
hitman 2 renderdoc capture 4 (190.00 MB, application/octet-stream)
2019-04-29 17:44 UTC, tempel.julian
hitman 2 renderdoc capture 5 (190.00 MB, application/octet-stream)
2019-04-29 17:51 UTC, tempel.julian
hitman 2 renderdoc capture 6/6 (146.67 MB, application/octet-stream)
2019-04-29 17:55 UTC, tempel.julian
bias change (598 bytes, patch)
2019-05-01 10:28 UTC, Samuel Pitoiset
Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description tempel.julian 2019-02-09 16:28:10 UTC
How it looks with radv:


Take a look at the hedges or other small plants: With radv, some leaves don't draw shadows, which they do with amdvlk (and on Windows with native D3D11). 

The renderdoc capture of this report should be valid for this issue as well:

mesa-git 19.1.0_devel.107387.55e00a2ea8b
llvm-svn 9 build on February, 5th 
dxvk-git 0.96.r26.g8543f964
Comment 1 tempel.julian 2019-02-09 16:30:14 UTC
And once again, I forgot explicitly mentioning the GPU (it's on the screenshots though):
It's a Polaris RX 580 card.
Comment 2 tempel.julian 2019-02-14 13:35:11 UTC
The hedges look quite awful with the latest git changes. :)
Comment 3 tempel.julian 2019-02-14 13:35:47 UTC
Created attachment 143379 [details]
broken hedges
Comment 4 Samuel Pitoiset 2019-02-14 13:45:07 UTC
What do you mean?
Comment 5 tempel.julian 2019-02-14 13:57:19 UTC
A few days ago, it looked like in my first comment of this ticket (not perfect due to the partially missing shadows, but bearable):

With one of the recent commits, it now looks like this:

Please take a look at the vegetation, especially the hedges. It looks like they are missing some detail texture or specular reflections.
Comment 6 Samuel Pitoiset 2019-02-14 14:00:57 UTC
Can you bisect? And eventually upload a renderdoc capture?
Comment 7 tempel.julian 2019-02-14 14:04:33 UTC
I'll try to do that. I'd be grateful though if there also was a solution for the missing shadows of small objects bug (initial bugreport), which hopefully the renderdoc capture of the linked issue is already helpful for. :)
Comment 8 tempel.julian 2019-02-15 21:48:20 UTC
Regarding the "hedges regression": Sorry, false alarm. It looks the same on Windows DX11, the game developer apparently has recently downgraded the game's visuals.
Comment 9 tempel.julian 2019-03-13 14:07:52 UTC
Updated screenshots with the latest game update including its content change:

radv-git (some small shadows missing):

amdvlk (no shadows missing):
Comment 10 Samuel Pitoiset 2019-03-13 14:31:33 UTC
Can you record a fresh renderdoc capture please?
Comment 11 tempel.julian 2019-03-13 15:04:56 UTC
Created attachment 143650 [details]
new renderdoc capture part 1
Comment 12 tempel.julian 2019-03-13 15:15:53 UTC
Created attachment 143651 [details]
new renderdoc capture part 2
Comment 13 tempel.julian 2019-03-13 15:18:02 UTC
Created attachment 143652 [details]
new renderdoc capture part 3
Comment 14 tempel.julian 2019-03-13 15:20:12 UTC
Sure, no problem. Upload is complete now.
Comment 15 tempel.julian 2019-04-09 09:51:23 UTC
It seems this is not limited to a single game, but a general issue. I could reproduce the behavior in Hitman 2, there are again some shadows missing with radv.


Comment 16 tempel.julian 2019-04-29 12:42:01 UTC
I changed the ticket title accordingly. Would a renderdoc capture for Hitman be desirable?

If you're really mean (which I'm of course not, issue is hardly noticeable) you could say that radv doesn't render lots of games correctly, so would an update regarding the matter be possible? ;)
Comment 17 Samuel Pitoiset 2019-04-29 15:43:25 UTC
Yes, please attach a new trace.
Comment 18 tempel.julian 2019-04-29 17:17:52 UTC
Compressing and uploading the capture is on its way.

Here are current screenshots showing the issue with latest mesa-git. When you switch between the images, you can clearly see some shadows missing with radv vs. amdvlk at the fence and at the trees in the background. This is completely reproducible, such as the issue in HotS.
Comment 19 tempel.julian 2019-04-29 17:27:53 UTC
Created attachment 144110 [details]
hitman 2 renderdoc capture 1
Comment 20 tempel.julian 2019-04-29 17:32:52 UTC
Created attachment 144111 [details]
hitman 2 renderdoc capture 2
Comment 21 tempel.julian 2019-04-29 17:39:17 UTC
Created attachment 144112 [details]
hitman 2 renderdoc capture 3
Comment 22 tempel.julian 2019-04-29 17:44:15 UTC
Created attachment 144113 [details]
hitman 2 renderdoc capture 4
Comment 23 tempel.julian 2019-04-29 17:51:02 UTC
Created attachment 144114 [details]
hitman 2 renderdoc capture 5
Comment 24 tempel.julian 2019-04-29 17:55:34 UTC
Created attachment 144115 [details]
hitman 2 renderdoc capture 6/6
Comment 25 tempel.julian 2019-04-29 17:56:13 UTC
Upload complete.
Comment 26 Samuel Pitoiset 2019-05-01 10:28:18 UTC
Created attachment 144120 [details] [review]
bias change

Can you try with this change applied?
Comment 27 tempel.julian 2019-05-01 11:52:18 UTC
Yey, it seems it is fixed without any drawbacks, as far as I can tell. :)


radv old:

radv new:

Hitman 2:

radv old:

radv new:

Once again: Thanks big time! :)
Comment 28 tempel.julian 2019-05-08 15:43:30 UTC
Would it be possible to ship this with one of the 19.1-rcs?
Comment 29 Samuel Pitoiset 2019-05-10 11:55:34 UTC
No because it's not a bug.

Per the Vulkan spec "26.11.3. Depth Bias":

"depthBiasSlopeFactor scales the maximum depth slope of the polygon, and depthBiasConstantFactor scales an implementation-dependent constant that relates to the usable resolution of the depth buffer."


"The minimum resolvable difference r is an implementation-dependent parameter that depends on the depth buffer representation."

That means, it might render differently based on that implementation-dependent parameter. Note that it likely renders something different with NVIDIA as well.

Closing as we can't do anything.
Thanks for the report!
Comment 30 Roland Scheidegger 2019-05-13 20:40:28 UTC
Frankly I don't know if the offset scaling makes any sense.
IMHO using the formula for fixed-point depth buffers d3d10 requires (luckily at least for float formats everybody (gl, vulkan, d3d10) agrees on the exact formula) would be way less trouble for everybody (pretty sure that would correspond to offset_scale of 1.0), although I'm not entirely sure it would actually fit the guarantee (of both gl and vulkan) that fragments always be distinguishable if they only differ by the implementation-defined r...

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.