pcsx2 icon indicating copy to clipboard operation
pcsx2 copied to clipboard

WIP: GS: Add Pre-Round Sprite hack

Open refractionpcsx2 opened this issue 3 years ago • 47 comments
trafficstars

:warning: THIS IS WIP - Things are gonna change and hopefully improve over time! This PR is currently broken, do not use :warning:

Description of Changes

This attempts to preproduce hardware behaviour of texel coordinates (0.5 centre), but falls down in a bunch of cases, hence the hack. But does fix a couple of long standing bugs.

Rationale behind Changes

In some cases, the PS2 will round down coordinates which PCSX2 does not, causing some issues with rendering. A prime example of this is Manhunt which draws a square over an area to hide lights, but uses a single pixel low alpha square in order to do so, and PCSX2 current misses this pixel by 1. This PR makes it pick the right pixel.

Suggested Testing Steps

Try games that have graphical errors (in software) and see if this resolves them. I've already checked Mercinaries, and Gran Turismo 4 also gets broken by this.

Fixes #257 Resolves the water effect mentioned here #1986

This PR kind of fixes the UI on Dark Cloud but causes some misaligned backgrounds.

Showcase of the two main fixes of this PR:

Beyond Good and Evil:

BGE Before

BGE After

Manhunt:

Manhunt Before

Manhunt After

refractionpcsx2 avatar Jun 30 '22 20:06 refractionpcsx2

Works perfectly! Thank you for doing this :)

5d-0 avatar Jun 30 '22 22:06 5d-0

Works perfectly! Thank you for doing this :)

Thanks :) there's still a lot to do, I want to make it less hacky and based more on hardware test results (confirming a theory on manhunt led to this) but we need more data, but it should provide some interesting testing.

I should Also note if anybody is testing manhunt in hardware mode, you also have to enable auto flush.

refractionpcsx2 avatar Jun 30 '22 22:06 refractionpcsx2

pcsx2: unknown1 pic from real hardware for reference: unknown

5d-0 avatar Jun 30 '22 22:06 5d-0

I don't know whether it's worth to report bugs at his point but here it is anyway. Maybe it will help somehow... Pre-round sprite hack breaks shadow rendering in this games: gs_20220701210748_Harry Potter and The Prisoner of Azkaban_SLUS-20926.zip gs_20220701211609_Ratchet _ Clank_SCUS-97199.zip gs_20220701212102_Jak and Daxter - The Precursor Legacy_SCUS-97124.zip gs_20220701212855_Jak II_SCUS-97265.zip

HelicopterP avatar Jul 01 '22 18:07 HelicopterP

Thanks, I mean it's worth checking those when we get more data to check, so it's appreciated. But as said in it's current state it WILL break stuff, I kind of expect it.

refractionpcsx2 avatar Jul 01 '22 18:07 refractionpcsx2

I haven't checked the other dumps, but I think I'm on to something here, using some information gathered on how STQ works, and used some theory on UV's (I believe we've come across this problem before)

Dark Cloud 2 seems to work in this, along with Manhunt and Beyond Good and Evil, so it feels a bit more promising.

Edit: Wild Arms 3 no longer needs the Wild Arms hack, so that's nice? At least at the time of writing this.

No doubt something else broke :D

refractionpcsx2 avatar Jul 01 '22 20:07 refractionpcsx2

ALL GS dumps posted above are fine now.

HelicopterP avatar Jul 02 '22 05:07 HelicopterP

Thanks, but now Manhunt isn't fixed again xD

Edit: Also noticed God of War doesn't like this also.

refractionpcsx2 avatar Jul 02 '22 06:07 refractionpcsx2

Note: This PR is still NOT right, but it's working okay.

Here's the current state of things that get fixed by this PR (unless it says "Not currently fixed" after it)

3-Nen B-Gumi Kinpachiu Sensei - sprite alignment for scene + character sprites (unknown if UV or ST, probably UV) Armored Core 2 garbage next to energy bar and radar (UV) Battle Gear 2 UI line ordering (interlacing) (UV) Beyond Good and Evil water (UV) Cho Aniki high scores font misalignment (UV) Dark Cloud 2 UI alignment (1 pixel more than TBW, possible clamping weirdness?) Devil May Cry 2 gap in the health bar when using SW mode (UV?) Dynasty Warriors 5 lines in floor (UV) Dynasty Warriors 6 lines in floor (UV) DBZ BT3 outline positioning (UV, possibly don't need upscaling hacks anymore/need adjusting) Everblue screen alignment/blur (UV) Gallop Racer 6 UI alignment Gallop Racer Lucky7 UI alignment Manhunt lights (STQ) Mercenaries lines in software (unknown if UV's or STQ at this point) New Roomania Shadow connection (bilinear'd UV's) Shadow of the colossus screen alignment (neither really better) Shin Megami Persona 3 UI element alignment/clarity during battles Ratatouille post process alignment (UV) Ratchet - Deadlocked (Wild arms redundant, use HPO Vertex and nothing else) Wild Arms 3 UI positioning (Wild arms hack redundant, use round sprite half for upscaling) WRC 2 Extreme UI some fonts (UV)

Affected but not currently working: Shin Megami Persona 3 minimap (STQ, 8bit trunc, not 9) - Not currently fixed.

refractionpcsx2 avatar Jul 03 '22 21:07 refractionpcsx2

~~I timidly believe this may have busted "Half Pixel Offset".~~ Nevermind...

mirh avatar Jul 14 '22 23:07 mirh

To a point, yes. They kinda do similar jobs, just at different points in the render.

refractionpcsx2 avatar Jul 14 '22 23:07 refractionpcsx2

Dynasty Warriors 6 also suffers from the same lines that 5 do, so it's worth checking too.

piau9000 avatar Jul 23 '22 00:07 piau9000

Dynasty Warriors 6 also suffers from the same lines that 5 do, so it's worth checking too.

do you have Dynasty Warriors 6 to check? I do not, unfortunately

refractionpcsx2 avatar Jul 23 '22 01:07 refractionpcsx2

Dynasty Warriors 6 also suffers from the same lines that 5 do, so it's worth checking too.

do you have Dynasty Warriors 6 to check? I do not, unfortunately

I do. What do you a want me to test?

Here's a gsdump showing the bug: (SLUS 21774) Dynasty Warriors 6 - Line Bug.zip

piau9000 avatar Jul 23 '22 19:07 piau9000

Normal: image

Preround: image

For upscaling, along with preround it needs Half Pixel Offset (Normal) and Round Sprite: Half in order to get rid of the line, otherwise it's still there. image

refractionpcsx2 avatar Jul 23 '22 19:07 refractionpcsx2

Over the years, I gathered some info about DW 5 and 6. What I noticed is that, if you put half pixel offset to vertex, it would make the lines thinner, making it less obvious (but they are still there). But if you put round sprite to half (to fix the vertical lines when upscaling), it would make the lines wider again, which is curious.

piau9000 avatar Jul 23 '22 20:07 piau9000

Over the years, I gathered some info about DW 5 and 6. What I noticed is that, if you put half pixel offset to vertex, it would make the lines thinner, making it less obvious (but they are still there). But if you put round sprite to half (to fix the vertical lines when upscaling), it would make the lines wider again, which is curious.

That is interesting, the HPO I understand as that corrects the upscaling issue, but of course it's wrong to begin with (As can be seen in native/software), so it kind of compounds the issue.

So hopefully once I've finished with this PR, that it will correct that part of it, so only HPO is required for upscaling (as above)., maybe round too, i dunno..

refractionpcsx2 avatar Jul 23 '22 20:07 refractionpcsx2

#2374

master image

PR With pre-round enabled image

#6724

master image

PR with pre-round enabled

image

Mrlinkwii avatar Oct 21 '22 10:10 Mrlinkwii

toggling pre round sprites hack seems broken with manhunt's lights on the latest windows pr

Bigmac9922 avatar Nov 25 '22 02:11 Bigmac9922

Unsure why, I've not changed anything

refractionpcsx2 avatar Nov 25 '22 02:11 refractionpcsx2

I tried toggling it in the display setting's but it seemed like it would fix the lights only to break when you walk around however I have little experience with pull request's so I might be wrong just thought I would tell you incase something was broken.

Bigmac9922 avatar Nov 25 '22 02:11 Bigmac9922

Honestly I didn't really walk around much, but this pr isn't perfect, there's still things to work out

refractionpcsx2 avatar Nov 25 '22 02:11 refractionpcsx2

Ok I just thought I would tell you incase you didn't know it might be broken hope this info helps you thanks for responding back so quickly.

Bigmac9922 avatar Nov 25 '22 02:11 Bigmac9922

Thanks for letting me know

refractionpcsx2 avatar Nov 25 '22 08:11 refractionpcsx2

Forgot to post this on the PR: (Breaks pause screen in Final Fantasy X)

FFX-SCES-50490.zip FFX-SCES-50490NoPreRound.zip

Should look like: Final Fantasy X_SCES-50490_20221208221325

Preround: Final Fantasy X_SCES-50490_20221208221143

Fine on both: Final Fantasy X_SCES-50490_20221208221151

RedDevilus avatar Dec 08 '22 21:12 RedDevilus

I tested the most recent artifact of this branch. For Persona 3FES I can confirm that the preround sprites does work, but only under the software renderer.
Software
image Vulkan
image

alexankitty avatar Feb 13 '23 06:02 alexankitty

Yes, I'm not sure why the HW renderer doesn't work, it might be specific to how the hardware renderer renders, it's potentially something we'll have to look at after this, when I get around to finishing this.. lol

refractionpcsx2 avatar Feb 13 '23 09:02 refractionpcsx2

Will this be merged before 1.7.0? I'm curious because this and some of the other old pull requests are really good submissions.

Felipefpl avatar Apr 15 '23 22:04 Felipefpl

1.7 is already available. It needs more work, I hope it'll be ready to merge at some point, I don't want to abandon it.

refractionpcsx2 avatar Apr 15 '23 22:04 refractionpcsx2

1.7 is already available.

As a nightly right? ;)

It needs more work, I hope it'll be ready to merge at some point, I don't want to abandon it.

Great! Good to know. :+1:

Felipefpl avatar Apr 16 '23 15:04 Felipefpl