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

Fix and further improve line drawing in Echochrome #15583

Merged
merged 5 commits into from
Jun 11, 2022
Merged

Conversation

hrydgard
Copy link
Owner

@hrydgard hrydgard commented Jun 10, 2022

I think it makes sense to take the absolute value of the computed pixel sizes. Once that's done, the rest of the math will be correct no matter the space. This fixes the squished lines.

Additionally, centering the thickened lines looks considerably better in this game, so let's add a special compat mode for that, it's not that much code.

We can enable it for any other games that use 3D lines. Doesn't make much sense for upscaled 2D lines though, which is the most common use of lines.

Fixes #15556

Also sneaks in a couple of minor things (gradle upgrade, TODO added)

@hrydgard hrydgard added the GE emulation Backend-independent GPU issues label Jun 10, 2022
@hrydgard hrydgard added this to the v1.13.0 milestone Jun 10, 2022
@unknownbrackets
Copy link
Collaborator

Hm, I suppose that seems reasonable. Should the height/widget scale also be absolute valued? I should check how this affects Persona...

Ridge Racer for example draws lines to a CLUT, which will cause problems if the line is centered since it'll end up (likely) getting filtered. On the PSP, the line definitely biases toward the lower right (well, maybe it's different on a flipped viewport, but I think the bias was in screen space.) So definitely don't want that everywhere. Could have some unexpected consequences.

-[Unknown]

@hrydgard
Copy link
Owner Author

Yeah, since the PSP doesn't have wider lines than 1 pixel, there's no defined way to render them at higher res, we just have to do the best we can when rendering at higher resolutions, and I think for 2D, bottom-right-biasing is the right thing indeed so I don't plan to change the default. Centered lines is only meant as a small nearly-free enhancement for games that look better with it like Echochrome, so it will stay a compat flag.

Pretty confident that abs is the right thing for pixel size measurement here as the math just breaks with negative pixel sizes, but I don't think we should do it for other scale factors (not sure exactly which ones you mean..).

@hrydgard
Copy link
Owner Author

By the way, I'm wondering whether it really makes sense to offset the UVs when making the line wider. Feels like it either wouldn't make much difference, or that we'd rather stretch the same texel across the width of the line rather than risking bringing neighboring ones into the mix...

@hrydgard
Copy link
Owner Author

hrydgard commented Jun 11, 2022

I've confirmed that this doesn't break Persona 2. Gonna merge, we can improve other things later. It nicely fixes the Echochrome regression at least, while being fairly safe.

(Optimized it a bit, far better codegen from avoiding reading from the destination, and it'll pay back if we one day write directly to GPU memory here).

@hrydgard hrydgard enabled auto-merge June 11, 2022 09:25
@hrydgard hrydgard disabled auto-merge June 11, 2022 09:25
@hrydgard hrydgard merged commit 59352bd into master Jun 11, 2022
@hrydgard hrydgard deleted the echochrome-lines branch June 11, 2022 09:39
@ghost
Copy link

ghost commented Jun 22, 2022

There's a incomplete game id in echo chrome compat.ini
IMG_20220622_224023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GE emulation Backend-independent GPU issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broken lines in Echochrome.
2 participants