Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WALL-E graphical issue for Work Day cutscene #14168

Open
Panderner opened this issue Feb 17, 2021 · 15 comments
Open

WALL-E graphical issue for Work Day cutscene #14168

Panderner opened this issue Feb 17, 2021 · 15 comments
Labels
Depth / Z Issue involves depth drawing parameters. GE emulation Backend-independent GPU issues
Milestone

Comments

@Panderner
Copy link
Contributor

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

@hrydgard hrydgard added the GE emulation Backend-independent GPU issues label Feb 17, 2021
@hrydgard hrydgard added this to the v1.12.0 milestone Feb 17, 2021
@unknownbrackets unknownbrackets added the Depth / Z Issue involves depth drawing parameters. label Feb 18, 2021
@unknownbrackets
Copy link
Collaborator

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]

@hrydgard hrydgard modified the milestones: v1.12.0, Future-Prio Aug 29, 2021
@unknownbrackets
Copy link
Collaborator

I tried to implement the logic from #12058 (comment) 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]

@hrydgard
Copy link
Owner

hrydgard commented Sep 6, 2021

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...

@unknownbrackets
Copy link
Collaborator

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:
#12058 (comment)

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]

@Panderner
Copy link
Contributor Author

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

@hrydgard
Copy link
Owner

hrydgard commented Sep 7, 2021

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.

@unknownbrackets
Copy link
Collaborator

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]

@hrydgard
Copy link
Owner

hrydgard commented Sep 7, 2021

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.

@ghost
Copy link

ghost commented Oct 22, 2021

DisableAccurateDepth can workaround this issue.

OFF

0Screenrecorder-2021-10-22-16-26-15-985.mp4

ON

1Screenrecorder-2021-10-22-16-27-18-675.mp4

@Panderner
Copy link
Contributor Author

Panderner commented Oct 22, 2021

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

Screenrecorder-2021-10-22-19-03-04-601.mp4

@ghost
Copy link

ghost commented Oct 22, 2021

Panderner how about Direct3d9 and, 11?

@Panderner
Copy link
Contributor Author

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

@Panderner
Copy link
Contributor Author

Fixed in Direct3D 11 but not Direct3D 9.

@hrydgard hrydgard modified the milestones: Future-Prio, v1.14.0 Aug 3, 2022
@hrydgard hrydgard modified the milestones: v1.14.0, Future-Prio Sep 1, 2022
@ghost
Copy link

ghost commented Sep 21, 2022

I cannot reproduce this issue on my Oppo a3s adreno 506 GPU might be fixed by #16068 or #16043

Is Direct3D 9 can be fixable?

@unknownbrackets
Copy link
Collaborator

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 added a commit to unknownbrackets/ppsspp that referenced this issue Dec 18, 2022
This fixes negative Z issues on D3D9 in many cases, such as hrydgard#14168
and hrydgard#16574, but only when clip planes are supported.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Depth / Z Issue involves depth drawing parameters. GE emulation Backend-independent GPU issues
Projects
None yet
Development

No branches or pull requests

3 participants