Skip to content

Conversation

@refractionpcsx2
Copy link
Member

@refractionpcsx2 refractionpcsx2 commented Jun 30, 2022

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

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 refractionpcsx2 changed the title GS: Add Pre-Round Sprite hack WIP: GS: Add Pre-Round Sprite hack Jun 30, 2022
@5d-0
Copy link

5d-0 commented Jun 30, 2022

Works perfectly! Thank you for doing this :)

@refractionpcsx2
Copy link
Member Author

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.

@5d-0
Copy link

5d-0 commented Jun 30, 2022

pcsx2:
unknown1
pic from real hardware for reference:
unknown

@HelicopterP
Copy link

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

@refractionpcsx2
Copy link
Member Author

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
Copy link
Member Author

refractionpcsx2 commented Jul 1, 2022

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 refractionpcsx2 force-pushed the gs_roundsprite branch 2 times, most recently from 2a96497 to 30138f8 Compare July 2, 2022 00:42
@HelicopterP
Copy link

ALL GS dumps posted above are fine now.

@refractionpcsx2
Copy link
Member Author

refractionpcsx2 commented Jul 2, 2022

Thanks, but now Manhunt isn't fixed again xD

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

@refractionpcsx2
Copy link
Member Author

refractionpcsx2 commented Jul 3, 2022

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 refractionpcsx2 force-pushed the gs_roundsprite branch 3 times, most recently from 263a401 to 0029168 Compare July 7, 2022 12:42
@mirh
Copy link

mirh commented Jul 14, 2022

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

@refractionpcsx2
Copy link
Member Author

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

@piau9000
Copy link

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

@refractionpcsx2
Copy link
Member Author

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

@piau9000
Copy link

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

@refractionpcsx2
Copy link
Member Author

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

@piau9000
Copy link

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.

@refractionpcsx2
Copy link
Member Author

refractionpcsx2 commented Jul 23, 2022

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

@Jakey757
Copy link
Contributor

Jakey757 commented May 5, 2024

Fixes Genji's distorted image in the software renderer #4401.
image
image

The hardware renderers show improvement, but still not quite right.
image

@JordanTheToaster
Copy link
Member

Fixes I-Ninja black line in geometry.
INinja Black Line.zip

Off:
I-Ninja_SLUS-20705_20240619024319

On:
I-Ninja_SLUS-20705_20240619024322

@lightningterror lightningterror added this to the Release 2.2 milestone Aug 22, 2024
@lightningterror lightningterror removed this from the Release 2.2 milestone Oct 3, 2024
@refractionpcsx2 refractionpcsx2 changed the title WIP: GS: Add Pre-Round Sprite hack WIP: GS: Add Pre-Round Sprite hack (Needs rewrite) Mar 15, 2025
@JordanTheToaster JordanTheToaster added this to the Release 2.X milestone May 17, 2025
@James-F2
Copy link

Dragon Ball Z - Budokai Tenkaichi 3 GS Dump for testing.

DBZ BT 3.zip

On real hardware there is no gaps in the black outline, particularly visible over the shoulders.

Real hardware:
DBZ BT 3 - Real Hardware

@James-F2
Copy link

James-F2 commented Oct 13, 2025

Pre-Round fixes the outline issue but also shift the 'halo' around the character to the right a lot.

Dragon Ball Z - Budokai Tenkaichi 3_SLUS-21678_20251013143418

@refractionpcsx2
Copy link
Member Author

yeah, this code certainly is far from perfect, in fact it's pretty hacky right now, hence the need for a complete rewrite :D It serves more as a proof of concept right now

This attempts to preproduce hardware behaviour, but falls down in a bunch of cases, hence the hack.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Manhunt (NTSC-U) [SLUS-20827] Lighting Issue/bug