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

Metallicness still acting strangely #56

Closed DoctorAnsem closed 3 years ago

DoctorAnsem commented 5 years ago

2019-03-30 11_14_47

While the roughness is looking very good now, it seems like there's still something odd about metallicness. For one, it turns the albedo map almost pitch black now, and it still has that major sparkly look to it. It probably looks way more overwhelming since it's blooming, but still it's not entirely the metallic outlook other PBR applications seem to give out.

And while I'm at it, this is a bit unrelated but I couldn't help but notice, with HDR rendering enabled all the lasers, particles, lightsabers, etc. look faded and washed out. A bit too transparent and unsaturated, I think. I could take a guess and say it's because of the linear space textures in srgb space, so would there be any way to connect these effects with SP textures?

PrismaticFlower commented 5 years ago

My answer to #55 probably applies here as well. But I do want to ask what kind of indirect lighting do the applications you're comparing it with use? I do know that without good indirect lighting metallic materials can look kinda rubbish. (And until there is something to bake indirect lighting for maps SP's SWBFII's indirect lighting will definitely fall in the "bad" basket.)

And while I'm at it, this is a bit unrelated but I couldn't help but notice, with HDR rendering enabled all the lasers, particles, lightsabers, etc. look faded and washed out. A bit too transparent and unsaturated, I think. I could take a guess and say it's because of the linear space textures in srgb space, so would there be any way to connect these effects with SP textures?

Actually you just discovered a pretty major bug. You see when HDR rendering is active all relevant vertex colors and textures are treated as being sRGB compressed and are put back into a linear space before being used. For most things this actually produces correct and reasonable results, for others (like stock normal mapped surfaces which are drawn in a, by modern standards, unconventional way) it doesn't. However particles typically responded well to this.

So you saying you were seeing washed out particles didn't sound right. I quickly tested it and agreed with your assessment. After some digging I found the cause. SWBFII normally halves the brightness of everything it renders and then when it renders it's light bloom it corrects the brightness to what it should be, and adds the bloom on top. When SP does HDR rendering this scale is forced to 1.0 (no change).

Due to an oversight on my part it seems like particles were not having this scale forced to 1.0 as they should be, resulting in every particle being drawn at half brightness. Once I knew the cause it was an easy fix and it'll be in the next release a86d3ee50c3b4ba3a91cd253037479cb3ce43d37.

To actually answer your question though, yes it would be possible and I've actually considered adding an particle_emissive rendertype for custom materials so modders could have greater control over which particles become subject to bloom.

DoctorAnsem commented 5 years ago

Oooh well that is a good question. I'm not a programmer so I honestly couldn't tell about indirect lighting and whatnot, but if it's any indication, I've been using that web tool you linked before for reference and Materialize to actually work with materials. They seem to give consistent results in relation to each other.