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

SP textures artifacting at mip distance #55

Closed DoctorAnsem closed 3 years ago

DoctorAnsem commented 5 years ago

2019-03-30 11_09_47

Kind of self-explanatory. If you look at the base of the street lights, you'll notice the ones closer to the screen have almost no white seams while the ones farther away look very jagged.

PrismaticFlower commented 5 years ago

Yeah, that's a real problem. I'm thinking I might buy a good book (or something) on the subject of PBR, just to get to know what I'm dealing with better. Since I suspect some of these problems are probably to do with issues in my implementation of it.

DoctorAnsem commented 5 years ago

Is that a PBR problem here though? The interior textures have the same issue but they're definitely normal_ext materials as I needed to preserve the vertex colors. In fact, when I think about it, I don't remember seeing any of the PBR materials having this issue at all so far, but there are plenty of normal_ext materials that do.

PrismaticFlower commented 5 years ago

Sorry, I just assumed from your other issue. What material types and settings are we talking about here exactly? (Just so we're on the same page.)

DoctorAnsem commented 5 years ago

It's just normal_ext and normal_ext.specular. I think the only connecting factor I can see is that I'm using emissive maps on the materials that artifact, but I don't know if that's even relevant or just coincidence. I should probably have clarified that the artifacting mostly happens on a tile basis, as in the UVs are directly stacked on top of each other in the problem areas. It's definitely something to do with the filtering of the texture, and actually it looks like turning anisotropic filtering off in game made the issue even slightly worse. I did try turning MSAA off too just to see if it changes anything, but that actually killed HDR completely so that's a no-go.

PrismaticFlower commented 5 years ago

Interesting, so it's only happening on emissive materials? Do you think it could be the emissive texture is bleeding over across adjacent UVs?

MSAA off too just to see if it changes anything, but that actually killed HDR completely so that's a no-go.

Well that shouldn't be happening either. I'll have to investigate.

DoctorAnsem commented 5 years ago

I'm not even sure how I'd describe it in technical terms, really. The emissive areas are far off the edges of the UVs which are bleeding, but it does look as if there is an emissive area bleeding through the seams. Perhaps a screenshot to emphasize?

streetlamp uv

If you'll excuse this 5 minute MS Paint job, I slapped the alpha channel of the emissive texture inside the red box just to show where the emissive areas are. (the base colors of the emissive map are identical to the diffuse) When comparing to the ingame picture, it's apparent that if it's the emissive map bleeding, it's bleeding pretty far. I haven't changed the EmissiveTextureScale from 1.0 either.

PrismaticFlower commented 5 years ago

Yeah, see the textures and UVs now that does seem like an unlikely explanation. Think you could zip up the relevant files (textures/materials) and send them to me? I think I may need to play around with this to understand it better.

DoctorAnsem commented 5 years ago

Sure. I'll send you a sample set on moddb.

So I didn't pay attention before, but I realized every time the bleeding happens it appears to happen at an edge of a UV island. (marked on the model by blue/unwelded edges in XSI) Do you think maybe this isn't explicitly a texture issue after all, but a polygon one? Although it's sure odd that it would happen only on the SP materials... man, I don't know. Just something that caught my eye, is all.

DoctorAnsem commented 5 years ago

Do you think maybe this isn't explicitly a texture issue after all, but a polygon one? Although it's sure odd that it would happen only on the SP materials...

That last part can be scratched. I just saw a model using stock materials tear up the same way, it didn't do so in pre-1.0.0 builds so the problem is at least not rooted that far back. It does seem like HDR might be a conduit that either makes it happen or makes it worse, I couldn't tell which is it though. What I can tell is that it definitely happens at UV edges, in other words, unwelded polygon seams.