PrismaticFlower / shaderpatch

Improved shaders (and fun stuff for modders) for Star Wars Battlefront II (2005) - Incompatible with Classic Collection
MIT License
39 stars 2 forks source link

Vertex colors and sRGB textures #78

Closed DoctorAnsem closed 3 years ago

DoctorAnsem commented 5 years ago

I'm guessing you might have seen this coming but as I've been using normal_ext and its subtypes to preserve the vertex coloring of models, it almost seems like there's a little bit of bad behavior when it comes to HDR and sRGB flags. When comparing a stock material side by side with a normal_ext material, there is a massive difference in the shading. As the stock material is more or less the "correct" color (as close as it can be with HDR) the normal_ext material actually goes almost pitch black in more shaded areas. I'm quite certain I've seen some note of this somewhere, something something vertex colors being forced into the wrong color space or so, but I couldn't find it and as such I couldn't figure out a convenient workaround for this.

So the big question is, can this be fixed any way at all or am I going to have to scrape off the paintwork? :/

Alternatively, I guess I could just not use HDR in cases like this, but you know. Lights kinda suck without it.

PrismaticFlower commented 5 years ago

I may have to get back to you on this after I get the chance to do some testing. The normal and normal_ext shader both handle the vertex colors the same way (or at least are supposed to and do seem to) so I suspect something else is at play here. If I can find what is causing the difference I will do my best to fix it.

PrismaticFlower commented 4 years ago

Did some testing (finally, again sorry about the delays on a lot of these). I couldn't seam to spot any difference (with HDR rendering) between a normal_ext material with sRGB textures and vertex colors and a normal material.

However I did spot something that could unknowingly be causing a problem with vertex colors. The StaticallyLit flag in materials can cause conflicts with models that were munged with -vertexlighting set. This conflicts could create problems or inconsistencies within a model. As such I have removed the flag starting from the next release. (A bit of a radical step I know, I may roll it back if anyone thinks it was a mistake.) This is strictly a a material_munge change and as such any materials/models munged with any previous versions tools will continue to function the same as before ingame.

Not actually sure if it'll help fix your problem or not but it should remove a potential pitfall from Shader Patch's materials in any case.

PrismaticFlower commented 3 years ago

Just closing a couple old issues that I'm no longer sure how to approach looking into. This just let's me see more clearly what I do still need to look into. Feel free to reopen (or create new issues) if any of them are still having an obvious impact.