julianxhokaxhiu / FFNx

Next generation modding platform for Final Fantasy VII and Final Fantasy VIII ( with native Steam 2013 release support! )
GNU General Public License v3.0
359 stars 49 forks source link

[ FF7 ] Field and World model textures appear half as bright #609

Open HeyItsLollie opened 1 year ago

HeyItsLollie commented 1 year ago

First of all, I just want to say a huge thank you for the recent improvements to model lighting. I've hoped that someone would take on the task for a few years now, and CosmosXIII's new fix works wonders.

A smaller bug is still present: Textures on Field and World models appear half as bright as they should, compared to PS1.

Here's a Field model comparison between PS1 and Steam. Screenshots were taken at the very start of the game, simply walk Cloud towards the camera as soon as you gain control. I'm using FFNx in this comparison for its comparable shading. FaceCompare1

And here's a comparison between PS1 and the original Steam release. Note that in this example, I've modified pixel.hlsl at Line 28 to multiply texture color brightness by 2, to demonstrate the potential fix. (this edit alone is not enough, as the edit affects all images) FaceCompare2


Here's the World model textures, starting with PlayStation. These screenshots were taken at Kalm, immediately outside of Midgar. Field_PS1

Steam, unmodified: Field_Steam-Stock

And Steam again, with the previously-mentioned texture color brightness hack applied to demonstrate the potential fix. Field_Steam-Hack (This also exposes an additional issue regarding vertex colors, which I've posted separately: #610 )

julianxhokaxhiu commented 1 year ago

@CosmosXIII any help on this part is appreciated. Thanks a lot

CosmosXIII commented 1 year ago

Thanks for the report. Not sure it is as simple as multiplying things by 2. Could it be that lighting was not applied to the textured parts in the PSX version and therefore making it brighter?

julianxhokaxhiu commented 1 year ago

I wonder if with DuckStation we could capture this detail, although it would be difficult to spot. Probably enabling Show VRAM and Show GPU State should be enough to detect if the emulator applies Shadows on the textures image

If anyone wants to help troubleshooting is welcome.

HeyItsLollie commented 1 year ago

I ended up taking a closer look. Unfortunately when it comes to DuckStation, I don't think these two settings can reveal anything that detailed about the interaction between specific polygons and textures.

duckstation-qt-x64-ReleaseLTCG - 2023-10-10 - 20-29-59

I tried chasing another idea: Hex-editing memory directly with Bizhawk to see how textures react to vertex colors. Bizhawk can only render at 1x resolution, making it harder to check the details. But from a glance, it seemed that maybe textures are unaffected by vertex colors.

BizhawkCompare PS1-Shading

In the Steam release, pixel.hlsl multiplies vertex colors with textures. Line 28, color *= texture_color; By altering this to color.rgb = texture_color.rgb; to force textures to render unlit, this should feasibly render a correct result. But a couple more problems arise.

1) Even with unlit textures, PC's textures appear too dark.

PS1vPC-with-corrections

Seeing this, I finally dug into FF7's textures to check what the ground truth was, and wouldn't you know it, the texture is exactly as dark as it appears on PC.

PS1vPC-texture

2) PS1's textures might actually be receiving shading after all.

The texture appears brighter on PS1, and it turns out there is actually a subtle gradient over the texture. I haven't dug into the model myself, so I don't know if the eye texture is directly on the vertex-colored polygon, or if it's floating above the vertex colors on a separate polygon. Either way, I'm guessing this gradient is a result of the game's lighting calculation.

CloudEye-TEXvPS1 PS1Shading

I'm reminded that there are PS1 games that have used vertex colors to produce overbrightness. Vagrant Story is one such game, another Square title. It's possible that this is what's happening here: Vertex colors are interacting with textures in such a way that they can become overbright, but this detail isn't being reflected in the PC version for some reason.