michael-fadely / sadx-dc-lighting

Sonic Adventure 1 palette lighting for SADX PC.
MIT License
39 stars 3 forks source link

Suggestions for material color support #71

Closed PiKeyAr closed 2 years ago

PiKeyAr commented 6 years ago

Here's a summary of what we've discussed so far. The default SADX behavior is apparently like this: 1) If a mesh has vertex colors - use those and ignore material colors. 2) If a mesh doesn't have vertex colors - set material color to FFFFFF. 3) If a mesh's material has the "ignore lighting" flag and the mesh has no vertex colors - use material colors. 4) Global material overrides (SetMaterialAndSpriteColor etc.) take priority over (2) and (3).

The PC version has a problem with (1) and (2) because the functions that render objects (as opposed to landtables) are set up to ignore vertex colors, so it always falls back on material color. In all versions of the game material colors are often nonsensical, so falling back on them often causes weird tinting or loss of detail. Example: image Here's a list of things that can be done to fix this problem globally: 1) Leave the default behavior regarding vertex colors. If a mesh has vertex colors - use those and ignore material colors. 2) All material RGB values should be treated as if they were FFFFFF with the following exception: 3) If the mesh doesn't have vertex colors and its material has "ignore lighting" - use the material colors. This is needed for the switch and to fix some minor visual issues that were there in console versions of the game, such as this one: image 4) Implement a toggle that disables (2) and possibly (1) for levels that make use of material colors.

edit 2019-02-24: note that the above example is in the landtable

Old post: It looks like _use_defaultdiffuse is no longer working with the most recent build of sadx-dc-lighting. For example, in FixCharacterMaterials.cpp there's this function that is supposed to apply the correct palette to Chaos6' model and some other boss models. The palette gets applied, but the material colors aren't reset. Here's what it's supposed to look like (material colors removed manually): image Here's what it looks like currently. The palette is correct, but the material colors give Chaos a blue tint: image I think this has been broken for a while because I noticed a few other material quirks in my mod in cases where I use this _use_defaultdiffuse thing.

PiKeyAr commented 2 years ago

There were two recent changes related to material colors: 1) The Mod Loader now patches material colors in vanilla models, which fixes their look but still allows mods to use material colors. 2) The Lantern Engine mod replaces the default material color (B2B2B2) only if the material doesn't have the "ignore light" flag. This behavior is consistent with vanilla SADXPC.

I think the way it works currently is good enough to close this issue.