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

Custom material terrain can be misaligned in some circumstances #92

Closed PrismaticFlower closed 4 years ago

PrismaticFlower commented 4 years ago

Uh. You might want to take a look at this. There's something that has gone horribly wrong with the geometry alignment here, I don't even know how to properly describe it.

Not sure what exactly is going on with it. Maybe the terrain is non-power of 2 or isn't a square and that is messing the geometry creation for it? Not sure exactly, I need to look into it more.

DoctorAnsem commented 4 years ago

Neither of those seemed to be the case, but I did find something curious and odd about it. It's a stock terrain so I always assumed it's done properly, but apparently there are some flaws in it. I think maybe it's still the same terrain file that used to be in the larger prototype Naboo map? It's a standard 256x256 terrain now, but the file size suggests it contains the data for at least double the amount of vertices, so as a result the edges of the terrain don't loop in ZE. This is one possible explanation. This scenario is easily recreated by selecting "create new terrain" in ZE and making it smaller than the original - I actually have another terrain I did that on before, and while it didn't get misaligned, it straight up rejected the custom materials without any errors. It just doesn't create the new terrain geometry at all.

The second, less likely, explanation could be that the half-assed texturing job of the Naboo terrain causes problems. (yes, apparently Pandemic devs made mistakes too) I found unused texture slots that were still painted on the terrain but no texture in them, and one edge of the terrain had a full tile of the bottom-most texture missing. This case I've already corrected but didn't get a chance to test yet, so I guess I'll share the results (or lack thereof) later.

DoctorAnsem commented 4 years ago

Yeah it wasn't the texture thing for sure. I don't know what it is, the resize thing I mentioned is my best guess but that's all it is, a guess.

DoctorAnsem commented 4 years ago

It seems the terrain from Kas2 (BF1) also shares the size thing I talked about, and also suffers from the bug. It's starting to be a pretty clear pattern.

Also worth noting is that this bug seems to be always paired with materials not getting mapped correctly, the entire terrain only has the first material. It was the same with the Naboo1 terrain.