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

[MGSPW/PO] Clipping issues? #12348

Closed
AkiraJkr opened this issue Sep 23, 2019 · 4 comments
Closed

[MGSPW/PO] Clipping issues? #12348

AkiraJkr opened this issue Sep 23, 2019 · 4 comments
Labels
Depth / Z Issue involves depth drawing parameters. Guardband / Range Culling Involves vertices outside fustrum.
Milestone

Comments

@AkiraJkr
Copy link

AkiraJkr commented Sep 23, 2019

I don't know when this started happening, but playing Portable Ops & Peace Walker, both games seem to present a similar issue to the one I made for Kingdom Hearts of the ground suddenly going invisible, and I made several GE Dumps. The problem still seems to happen in any backend.

The Peace Walker GE Dumps seem to work fine as opposed to the Portable Ops ones.

PW GE Dumps:
https://cdn.discordapp.com/attachments/478294170662862852/625631606207676452/recording_pw1.ppdmp
https://cdn.discordapp.com/attachments/478294170662862852/625631604945059850/recording_pw2.ppdmp
https://cdn.discordapp.com/attachments/478294170662862852/625631605230272517/recording_pw3.ppdmp
https://cdn.discordapp.com/attachments/478294170662862852/625631604076707850/recording_pw4.ppdmp

And here's the Portable Ops ones, that apparently don't work.
https://cdn.discordapp.com/attachments/478294170662862852/625631805881581579/recording_po1.ppdmp
https://cdn.discordapp.com/attachments/478294170662862852/625631809392345098/recording_po2.ppdmp

And here's some images, comparing some of the GE Dumps in each backend.
AkiraJkr/imgur-sucks#4

@unknownbrackets
Copy link
Collaborator

Correct result:
ULUS10509_#12348_mgs_peace_walker_clipping

Software result:
ULUS10509_#12348_mgs_peace_walker_clipping_softgpu

GL:
ULUS10509_#12348_mgs_peace_walker_clipping_gl

This is caused by draw 1703/4984, which is getting partially culled, but some par of it shouldn't.

  • It's a triangle strip with 9 verts (so 7 triangles)
  • Depth clamp is enabled
  • Viewport depth is unusual (center = 30000, scale = -20000 -> 2710-C350)
  • Min/max Z matches the viewport depth range (2710 / C350)
  • Looking casually, only two points look like they'd trigger culling: (-10398.887695, -3312.689453, -293688.593750) and (2609.670898, 735.081543, 55598.062500)
  • Since those have clampable depths, they should not be culled.

This probably means there's still some misbehavior like culling when depth is outside the viewport/minmaxz range or something.

-[Unknown]

@unknownbrackets unknownbrackets added the Depth / Z Issue involves depth drawing parameters. label Oct 1, 2019
@hrydgard hrydgard added the Guardband / Range Culling Involves vertices outside fustrum. label Oct 1, 2019
@hrydgard hrydgard added this to the v1.10.0 milestone Oct 1, 2019
@hrydgard hrydgard modified the milestones: v1.10.0, v1.11.0 May 31, 2020
@hrydgard
Copy link
Owner

As far as I know, these games don't need range culling anyway - as a quickfix, I'll just disable that for them, then leave this open.

@hrydgard hrydgard modified the milestones: v1.10.0, v1.11.0 May 31, 2020
@hrydgard hrydgard modified the milestones: v1.11.0, Future Nov 29, 2020
@unknownbrackets
Copy link
Collaborator

The vert triggering cull (incorrectly) is (2609.670898, 735.081543, 55598.062500). Not sure why I said it was mistakenly outside [0, 65535] before.

Its pre-viewport/offset coordinates are (9.873632,-4.405027, -1.279904). Although I haven't implemented it to verify yet, this strongly suggests that as per #14168 / #12058, pre-viewport Z < -1 should trigger triangle to be clipped and no longer outside the guardband for culling. It looks like implementing that would fix this.

-[Unknown]

unknownbrackets added a commit to unknownbrackets/ppsspp that referenced this issue Sep 10, 2021
Culling is based on whether clipping happens, not whether clamping
happens.  This is important for issues like hrydgard#12348.
@unknownbrackets
Copy link
Collaborator

This was fixed in #14833, with or without hardware clip/cull/geometry support. The frame dump renders correctly without any compat flags, etc. As such, closing this.

We should probably remove the use of the compat flag. It might be that there are scenes in this game which do rely on range culling. In the specific case of this bug, it was the viewport Z and the previous culling was incorrect and culling things it shouldn't.

-[Unknown]

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. Guardband / Range Culling Involves vertices outside fustrum.
Projects
None yet
Development

No branches or pull requests

3 participants