ppsspp icon indicating copy to clipboard operation
ppsspp copied to clipboard

WALL-E graphical issue for Work Day cutscene

Open Panderner opened this issue 4 years ago • 13 comments

In Work Day the 4th level for WALL-E there's a graphical artifact during a cutscene

OpenGL: Screenshot_2021-02-17-16-10-28-403_org ppsspp ppsspp

Vulkan: Screenshot_2021-02-17-16-09-51-432_org ppsspp ppsspp

GE dump: ULUS10350_0001.ppdmp.zip

Panderner avatar Feb 17 '21 08:02 Panderner

This definitely seems depth clamp related. Draw 73/134 uses especially wild depth values, and causes this glitch. This isn't the only prim that causes problems, but it's the main one.

It should look like OpenGL: ULUS10350_#14168_walle_workday_glitch

Which is how Vulkan looks if I force the depth clamp flag off. Min Z/max Z are full range, so this isn't a clamp skew issue, it must be a case where it shouldn't actually clamp.

-[Unknown]

unknownbrackets avatar Feb 18 '21 04:02 unknownbrackets

I tried to implement the logic from https://github.com/hrydgard/ppsspp/issues/12058#issuecomment-913225641 in the software renderer, and test in a few scenarios... but this one is not rendering correctly there. So I suspect there's more to it in some way. It might be that w is still involved, after all (although I'd tried a test that should've validated that, there's more cases to try...)

This particular draw is 966 verts, which makes it harder to intuit which triangle is being incorrectly drawn... I've been creating tests with specific triangles from dumps manually. Maybe I need to make some tool to slice and dice frame dumps...

-[Unknown]

unknownbrackets avatar Sep 06 '21 06:09 unknownbrackets

Yeah, I have a feeling that this is one of those issues where we'll come up with a bunch of complicated rules to figure out what shouldn't be drawn, and there's really a smaller number of much simpler rules that could explain it all, but that are very hard to intuit from the data...

hrydgard avatar Sep 06 '21 07:09 hrydgard

Perhaps, but it does seem to have pretty specific rules. Maybe there's indeed something simpler about it all..

The reason for this was that I'd removed the Z clipping when changing it (I actually did that intentionally so I'd notice if it should be kept), and it indeed should be kept for the negative side: https://github.com/hrydgard/ppsspp/issues/12058#issuecomment-913937188

Still hoping to get some time to compare back with guardband culling. For example, when a vertex's depth is clamped, that vertex also becomes immune to guardband culling. But is this behavior actually driven off the pre-viewport Z? This might explain some cases where guardband culling is overzealous (when viewport Z scale is 32768 or similar.)

-[Unknown]

unknownbrackets avatar Sep 07 '21 02:09 unknownbrackets

This also affects Direct3D 9 and 11. Here's a screenshot for D3D9: Screenshot (14)

Panderner avatar Sep 07 '21 04:09 Panderner

But is this behavior actually driven off the pre-viewport Z?

That indeed seems likely from your findings! And the immunity is not likely to be actual 100% immunity, but those long thin triangles that usually are in danger of the guardband are produced by large perspective distortion of triangles crossing the view plane beyond the edges of the viewport, and clipping will cause the new triangle corners to get back inside the guardband. But for practical purposes I think we can emulate that with immunity.

hrydgard avatar Sep 07 '21 07:09 hrydgard

Well, that's what I meant by immunity, but indeed maybe there are actual cases where a triangle might get clipped (depending on how the clipper works...) with it still outside the guardband. Hopefully we don't need to worry about that...

-[Unknown]

unknownbrackets avatar Sep 07 '21 07:09 unknownbrackets

Yes I think there are some theoretical edge cases since the clipper is still against the (pre-viewport) Z plane, and not against any side planes, but we can indeed probably just ignore that, at least for the hardware renderers.

hrydgard avatar Sep 07 '21 08:09 hrydgard

DisableAccurateDepth can workaround this issue.

OFF

https://user-images.githubusercontent.com/37603562/138421033-7a0538ca-7e8d-48f3-a180-dac3be3efde0.mp4

ON

https://user-images.githubusercontent.com/37603562/138421080-299f545f-de6d-40ac-abe0-79e90d8336db.mp4

ghost avatar Oct 22 '21 08:10 ghost

I don't need to turn on DisableAccurateDepth for this game for my phone using vulkan.

https://user-images.githubusercontent.com/37503397/138443873-d8a790f9-010f-43e9-9ccf-9356cf81fcbc.mp4

Panderner avatar Oct 22 '21 11:10 Panderner

Panderner how about Direct3d9 and, 11?

ghost avatar Oct 22 '21 11:10 ghost

@Gamemulatorer unfortunately my PC is broken. I Go hiatus for PC testing.

Panderner avatar Oct 22 '21 13:10 Panderner

Fixed in Direct3D 11 but not Direct3D 9.

Panderner avatar Aug 03 '22 09:08 Panderner

I cannot reproduce this issue on my Oppo a3s adreno 506 GPU might be fixed by https://github.com/hrydgard/ppsspp/pull/16068 or https://github.com/hrydgard/ppsspp/pull/16043

Is Direct3D 9 can be fixable?

ghost avatar Sep 21 '22 00:09 ghost

Direct3D 9 should look better if you turn off hardware transform, since it'll apply cull distance for you. It won't apply clip distance, though, so not all of the artifacts will be fixed. In theory, we could clip triangles in software transform, but it's not implemented.

It also won't work on any device without clip distance and working geometry shaders, which is mostly older Mali devices and some other devices.

Modern GPUs that support clip and cull distance (including Adreno) should be fine and no longer have this issue for some time now.

-[Unknown]

unknownbrackets avatar Oct 17 '22 05:10 unknownbrackets