emoose / OutRun2006Tweaks

Turning and spinning and spinning and turning, woah!
MIT License
358 stars 0 forks source link

[Bug]: UI textures cut off when okay in sprite atlas #64

Open thegreatprophetzarquon opened 4 months ago

thegreatprophetzarquon commented 4 months ago

Many, if not all, of the game's UI sprites have cut-off issues if they reach the border of their sprite atlas (even though they are within the defined boundaries and should be okay).

A sample can be seen below for the white numbers in the upper right corner, but this is also noticeable on many of the game's textures, like the "Game Over" sprite, the racer positions in-game and lots of stuff in the C2C menus; really anywhere the atlases are tight (but shouldn't produce any cut-off). This does not occur in the PS2 version of C2C (didn't check the Xbox but I assume it's fine too) and may have something to do with the weird half-pixel offset thing DX9 has that's not accounted for in this port.

2

emoose commented 4 months ago

Wonder if it's similar to the #63 issue with DX9's half-pixel offset possibly making it break, or maybe the x/y/width/height that it's using to take it from the texture atlas is incorrect.

Maybe try the suggestion in #63 with MSAA and DXVK and see if anything changes, otherwise I guess we might need to edit the sprite file header to change where it gets it from the atlas.

DonelBueno commented 4 months ago

A064FDFC_1024x512.dds texture file involved, it seems like the numbers here are only used for the positions. For the timer, speedometer, etc, it uses other files. Offsetting the number 1 "solves" the issue, I think it is using the wrong values for the texture atlas.

OR2006C2C_2024_07_13_16_36_15_739

EDIT: ah, I've only seen now that the white numbers and the slash symbol are affected as well, I'm going to take a look at it soon.

thegreatprophetzarquon commented 4 months ago

Still has the issue when using DXVK and ensuring MSAA is off.

thegreatprophetzarquon commented 4 months ago

This seems mostly like sloppiness in the C2C port, as it's present in the PS2 version as well. It may related to to them reusing the Xbox/original Outrun 2 "squared style" white position counters for this, rather than the round ones from SP2 and later they otherwise use. The position counters overlayed over the rivals (12th, ect) do use the right font, but similarly also seem to have bits cut off.

You also see this with some other texture atlases, most noticeably the top pixel of "®SEGA Corporation, 2006 SEGA, the SEGA logo and OutRun 2006 Coast 2 Coast are registered trademarks or" on the opening studio logos is cut off.

emoose commented 4 months ago

The tool at https://github.com/emoose/OutRun2006Tweaks/issues/75#issuecomment-2244498483 should let us adjust the atlas positions / sizes now, might be possible to fix some of the cut-offs if anyone wants to dive into it. (it might also let us fix some of the sprites that had weird scaling applied too, wonder if we could also fix the cutoff flag-man sprites with it...)

Also have an idea for allowing Tweaks to read in overrides for the atlas positions, rather than needing to go through repacking the SZ each time, would be easier to share those overrides as well... probably need to see whether these atlas changes can actually help things first though.

thegreatprophetzarquon commented 4 months ago

724460-930973_20060427_001 As a side note, it looks like the review copies for the PSP version had the counters like this (they have been updated in the final game), which would seem to confirm that it's a very late change.

https://www.gamespot.com/games/outrun-2006-coast-2-coast/

thegreatprophetzarquon commented 3 months ago

Got OR2Tool to work after I rather embarrassingly figured out I had been pointing it at the .sz files in the "Sprani" folder rather than "Sprite" folder. I've been looking at these in Atlased (again, so impressive that you've done all of this; hats off to you). Weirdly enough, the white numbers in this issue and much of the rest of the game's sprites that have obvious cutoff (like the Game Over and stuff on the Sumo menus), do not have issues in the json atlas itself. Using hi-res replacements shows less of an issue, so I do believe it's something to do with the DX9 half-pixel offset or something else.

The big position numbers here do have issues with both their atlas and how they are spaced/implemented in-game (like "11, 21," ect. being spaced too tight). I can eventually make a fix to the atlas that at least gets those all on the same line.

thegreatprophetzarquon commented 2 months ago

Given that this got tagged as "partially complete," I'm editing the issue to specifically be about the sprite cutoff that happens when the atlases are correct (this is most noticeably the white numbers in the original image, but also the "Game Over" sprite, the position counters, lots of stuff in the menus, ect). It effects many, if not all, UI textures that go up to the atlas border, so something's going on at the rendering level.

There's a separate issue for the bigger numbers' issues: https://github.com/emoose/OutRun2006Tweaks/issues/79 and using OR2Tool we can determine that that and some other sprite oddities (like the color selector in SP2 mode) are baked into a combination of the sprite atlases and C2C's coding.