pcsx2
pcsx2 copied to clipboard
WIP: GS: Add Pre-Round Sprite hack
: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:


Manhunt:


Works perfectly! Thank you for doing this :)
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.
pcsx2:
pic from real hardware for reference:

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
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.
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
ALL GS dumps posted above are fine now.
Thanks, but now Manhunt isn't fixed again xD
Edit: Also noticed God of War doesn't like this also.
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.
~~I timidly believe this may have busted "Half Pixel Offset".~~ Nevermind...
To a point, yes. They kinda do similar jobs, just at different points in the render.
Dynasty Warriors 6 also suffers from the same lines that 5 do, so it's worth checking too.
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
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
Normal:

Preround:

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.

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.
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..
#2374
master

PR With pre-round enabled

#6724
master

PR with pre-round enabled

toggling pre round sprites hack seems broken with manhunt's lights on the latest windows pr
Unsure why, I've not changed anything
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.
Honestly I didn't really walk around much, but this pr isn't perfect, there's still things to work out
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.
Thanks for letting me know
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:

Preround:

Fine on both:

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
Vulkan

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