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

Black boxes are still showing up #97

Closed DoctorAnsem closed 4 years ago

DoctorAnsem commented 4 years ago

Video

It's not the only case I'm witnessing it on. It seems to always be something to do with a cloth object, but I'm not sure on the details. It's definitely been a pattern though, with the normal_ext.specular.dynamic rendertype. Sometimes it happens with stock cloth too, but it's a more rare occurrence and it seems like that one is more to do with transparency on the cloth.

PrismaticFlower commented 4 years ago

Ah interesting, must be some problem with the tangents being created in the pixel shader for the cloth or something.

I know I ask this a lot and I feel really bad constantly asking it but is there any chance I could get the munged side that has one of the problematic units in it (+ the Lua snippet needed to load the unit) . It'd probably help me track down the problem quicker. As always it's all good if you'd rather not, it'll just take me a bit longer to find and setup my own test case that recreates the bug.

Sometimes it happens with stock cloth too, but it's a more rare occurrence and it seems like that one is more to do with transparency on the cloth.

That one sounds like it's going to be hard to track down. But I'll keep my eyes open.

DoctorAnsem commented 4 years ago

It shouldn't be too hard to scrounge up in this instance. I'll zip it up.

PrismaticFlower commented 4 years ago

Cheers. I've downloaded it, feel free to delete it from your drive whenever the mood strikes.

PrismaticFlower commented 4 years ago

Just an update this is high on my todo list to fix, I really want to try and get a fix out for it this weekend.

I haven't had any luck with getting those sides ingame unfortunately. The black boxes sadly do not seam to appear on the spawn screen and whenever I tried to spawn the game crashed without any indication as to what I had done wrong.

So I'm now planning to take the hard route and try setting up a custom side that reproduces the issue. I've been busy with other things so I haven't got to it yet however.

DoctorAnsem commented 4 years ago

That type of crash definitely rings a bell but I can't remember how I resolved it. I wonder if it's the hard animation memory cap you've hit - as per the note I made before, Fisto's animations eat a ton of memory, to the point where PC can only handle him +1 lightweight Jedi class in a single mission. Other than that the only thing I can think off are memory pools. As such you'd need a higher than average SoldierAnimation pool, something like 500-600. Combo pools need to be large too, though the pool sizes from stock hero assault have proven to be enough. And then there's the tentacle memory pool, but I'm not sure if that's capable of crashing the game.

PrismaticFlower commented 4 years ago

Sorry about the (quite frankly at this point ridiculous) delay. I've finally been able to reproduce this. (Well I don't if I reproduced your exact problem, but I've certainly reproduced a variant on it at the least.)

Star Wars Battlefront II 23_11_2019 7_21_37 PM

So what I did to cause this was give faces on the cloth non-varying texture coordinates/UVs. So at each vertex that makes up face the UVs aren't unique, which for correct tangent generation in the pixel shader they're required to be.

Not sure if I can actually fix this on Shader Patch's end, not without paying an unneeded performance cost at least. When you get the chance do you think you could investigate what the UVs are like on the cloths that are giving you trouble and see if making sure that they vary across each face (each vertex making up the face having unique UVs) making up the cloth resolves the problem? (I assume XSI has some way to visualize the UVs for a model that should make this easy?)

If it doesn't I'll need to try doing some more hunting for your specific problem. Another possible heavy handed solution would be a normal_ext shader that doesn't use a normal maps, that would remove the need for tangent vectors and in a roundabout way solve the problem.

DoctorAnsem commented 4 years ago

Huh, I guess that was it. Fisto's model had 2 vertices in the cloth that weren't spread out correctly, moving them away to form proper triangles indeed got rid of the black boxes. What a meme. At least I know where to look if it happens again, I guess.

PrismaticFlower commented 4 years ago

Glad you were able to get it sorted and now we know for anyone else that encounters the problem. Hopefully that is the last "black box" issue we'll encounter as well.