Author Topic: [FF7PC] Are there any mods that fix the PC port's broken lighting?  (Read 5915 times)

Lollie

  • *
  • Posts: 8
    • View Profile
    • Lollie.me
Ever since the '98 Eidos port (and right up to the most recent console ports), every room in FF7 has had broken lighting. The ports light everything from the camera's position (like a camera flash), instead of using each room's lighting information. Edit: See Reply #8!

Are there any mods that fix the lighting? Or any hard info on why the lighting is broken like this?

(Imgur album with full-res comparison images)

« Last Edit: 2021-07-20 01:45:15 by Lollie »

Kuraudo.

  • *
  • Posts: 256
  • Panta rei
    • View Profile
You are talking of the 3d models light in field right? That's a known issue. But I'm not sure if anything was done yet.
« Last Edit: 2021-02-23 06:47:14 by Kuraudo. »

Fewtch

  • *
  • Posts: 74
  • All good things in time
    • View Profile
    • ArtStation
Its wild that Ive never noticed this before, nor have a heard any mention of it anywhere, but there it is, impossible to miss now that I see it.  ???

Kuraudo.

  • *
  • Posts: 256
  • Panta rei
    • View Profile
Anyway I did use search and these are the topics where there is some information about it:

2005: http://forums.qhimm.com/index.php?topic=4582.msg61116#msg61116
2009: http://forums.qhimm.com/index.php?topic=8896.msg116056#msg116056
2016: http://forums.qhimm.com/index.php?topic=16822.msg238245#msg238245
2016: http://forums.qhimm.com/index.php?topic=17323.msg246294#msg246294
2017: http://forums.qhimm.com/index.php?topic=17377.msg246931#msg246931

Long story short at the moment there is no mod and/or fix that adjust that behavior.

EDIT: As of now Cosmos create a mod for it, Cosmos Lighting
« Last Edit: 2021-04-10 17:54:22 by Kuraudo. »

Kaldarasha

  • *
  • Posts: 2450
  • Prince of Model Editing
    • View Profile
Its wild that Ive never noticed this before, nor have a heard any mention of it anywhere, but there it is, impossible to miss now that I see it.  ???

I have brought this up some years ago on the reunion thread. The problem is a bit difficult. The main problem is probably a difference in displaying coordinations. The PSX has some strange logic and doesn't follow the usual xyz. Though the PSX does also bake the light on the models and I can't say in what position it does that. On PC the light is applied in real time on the model.

Lollie

  • *
  • Posts: 8
    • View Profile
    • Lollie.me
2005: http://forums.qhimm.com/index.php?topic=4582.msg61116#msg61116
Wow, 2005. This thread in particular gave some decent insight into FF7's field lighting, thank you for digging it up!

I have brought this up some years ago on the reunion thread. The problem is a bit difficult. The main problem is probably a difference in displaying coordinations. The PSX has some strange logic and doesn't follow the usual xyz. Though the PSX does also bake the light on the models and I can't say in what position it does that. On PC the light is applied in real time on the model.
Ah, I saw your name in Reunion's big spreadsheet about this bug! I never realized that FF7-PS1's lighting wasn't being updated on every frame, that's a funny quirk. Thanks for the info!

After a little poking around, I have a suspicion that lighting is baked into models based on what the first available animation is for each model per field (this usually ends up being a neutral standing pose). It seems though that Makou Reactor can't currently edit which models appear per field in FF7-PS1, so I don't know how to test this theory..

Kaldarasha

  • *
  • Posts: 2450
  • Prince of Model Editing
    • View Profile
In other news someone is working on light with a new approach with amazing results.

Kuraudo.

  • *
  • Posts: 256
  • Panta rei
    • View Profile
Here you can found the new mod now available: Cosmos Lighting
« Last Edit: 2021-07-31 17:57:37 by Kuraudo. »

Lollie

  • *
  • Posts: 8
    • View Profile
    • Lollie.me
Here you can found the new mod soon to be available: Cosmos Lighting
This is ridiculously cool, very promising.. Hopefully it progresses so that it can be controlled per scene, somehow!



I ended up returning to FF7PC this weekend to do some testing, and I have a better understanding of how the lighting system works. My original assumptions were totally wrong. There's no coordinates mismatch between PS1 and PC, no automatic "lit from the camera's position", none of that.

So... The correct lighting data is technically still here in the PC version. But there's something weirder going on. Here's an example from "md1stin", the very first scene in the game.


The original lighting can be found in the first lighting channel, outlined here in Makou Reactor's Field Models editor.


By zeroing out the second and third lighting channels, the first channel can be isolated. And so we get this.


Notice how the vertex lighting pinches the same way down Cloud's forehead, and down the front of his pants. Or how the gradients in his hair travel in similar directions.

Now, the lighting on PC is still noticeably darker compared to PS1. Unfortunately, Makou Reactor currently lacks the ability to edit Field Models data for FF7-PS1, so I can't test how all the lighting channels function on PS1. I don't know if the other two light channels are contributing to the lighting on PS1, or if they're supposed to be disabled, or something else.

My suspicion is that there's a value on PS1 that says which channels are active (possibly the "Unknown" value in Makou Reactor's Field Editor?). If this value exists, it is being ignored on PC, meaning FF7-PC is using all of the lighting channels instead. I don't have a way to test this though, so I can only call this a big guess. Chances are I'm totally wrong!

Another part of the lighting that's currently broken is the textures on Field Models. They're all darker than they're supposed to be. My suspicion (big fat guess! probably wrong!) is that vertex lighting isn't being applied additively to textures, and is merely tinting the textures. This means model textures never get to be brightened, only darkened. I'm unable to test this theory, but as a proof of concept, I tried multiplying the brightness of textures by adding a dirty hack to "pixel.hlsl" in FF7-PC's "shaders" folder. You can already see how much of a difference this makes.


For prosperity, here's my dirty little shader hack for "pixel.hlsl". This affects literally every single texture in the game. Model textures look better, but every background becomes blindingly bright, so it's only good for curiosity's sake.
Code: [Select]
if(texture_flag != 0)
{
if(texture_color.a == 0.0) discard;

texture_color *= 2; // dirty hack!!

color *= texture_color;
}



Finally, here's how the Field Model lighting works.


Global light is an ambient tint. It tints the entire model with a flat color, with no additional lighting.
Black (#000000) causes the model's base brightness to be a flat black, while White (#FFFFFF) causes the model to appear fully unlit. Most scenes use a Dark Gray by default (eg: #404040, #595959).

Directional light has three channels, where each channel features a Vector3, X / Y / Z.
You might think these are "position" or "rotation" values. They're more like "Strength" values? They have a 16-bit range, from -32768 to +32767, where 0 is the "OFF" value.

Edit: It's been brought to my attention, it's possible that light direction is determined via a vector dot product, and then light intensity is calculated via vector length. I'll have to do more testing later to confirm this. (end edit)

To demonstrate the basics of how Directional Light works, here is a GIF. Please enjoy this animation of Tifa stuck in the Light Box.


On PS1, directional lighting is baked into field models on a per-scene basis. A model can rotate and move as much as they like, but directional lighting will stick to the model like paint.
On PC, directional lighting reacts to model rotation. A boost in lighting features! Note: Directional lighting is local to field models, and so a model's position does not affect lighting at all.


...And that's all I've got! I hope this information is useful to... someone who knows anything about altering the inner workings of FF7-PC.
« Last Edit: 2021-07-20 10:24:58 by Lollie »

Sega Chief

  • *
  • Posts: 3974
  • These guys is sick
    • View Profile
I'm no expert on how the models/lighting etc. work but you mentioned that you were guessing that lighting wasn't being applied additively to Cloud's PC field model textures, and I think I can confirm that this is the case.

Opening Cloud's PC field model in Kimera, there are a few groups assigned to polygons to display the textures for his right eye, left eye, and mouth. They use no blending mode (where the options are Average, Additive, Substractive, Unknown, and None):


Kaldarasha

  • *
  • Posts: 2450
  • Prince of Model Editing
    • View Profile
I think it is more possible, that textures are unaffected by the light on the PSX to keep the stress on the hardware small. On PC they just didn't cared about this behavior and they probably didn't knew of it.

Lollie

  • *
  • Posts: 8
    • View Profile
    • Lollie.me
I'm no expert on how the models/lighting etc. work but you mentioned that you were guessing that lighting wasn't being applied additively to Cloud's PC field model textures, and I think I can confirm that this is the case.
I ended up doing some more poking around, and the answer might be even simpler. On PC, textures on models appear to be rendered half as bright as they're supposed to be. Like, if a vertex color has a range of 0-100%, textures on models seemingly only reach 0-50%. Doubling how bright textures render could actually be the way to fix them. It could probably be done via the "pixel.hlsl" shader file, if someone can figure out what variable FF7-PC needs in order to specifically target textures on models. (otherwise, you end up with backgrounds, menu graphics, and world-map skies being rendered too bright as a result.)

I landed on this answer while having a quick peek at the World Map, it turns out this texture brightness rendering issue affects *all* textured models. It's not the only issue, but it makes a big difference.

[full-res screenshot comparison via this Imgur album]

I think it is more possible, that textures are unaffected by the light on the PSX to keep the stress on the hardware small. On PC they just didn't cared about this behavior and they probably didn't knew of it.
Naw, PS1 could handle both vertex lighting and vertex colors on textured models without any big issues - Crash Bandicoot, Tekken 2, and Tomb Raider are all examples.

Here's a quick shot from FF7-PS1 (using a very high internal resolution in DuckStation to get a clean screenshot). You can see that the same features are darker on the more shadowed side of Cloud's face. Textures are definitely affected by field lighting in FF7-PS1.