-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split model components into their own meshes #7
Conversation
Mesh parts with different damage states seem to be differentiated by their UV coordinates' integer portions - the charger's undamaged head lies in U range [8, 9), and the destroyed head is in U range [9, 10). This change splits the exported mesh up by these U ranges.
I was mentioning it as "at least one way" because I wasn't sure if those components were described in any other way in the unit format. I'm not actually aware of a different way of doing it currently, that would need more research - sorry for the confusing wording Also all the components should be split - the leg and hind gore shouldn't be combined - I'll have to check what's going on there when I get a chance |
Don't worry about it, I appreciate any contribution :) That'd be cool if you could look into it, take your time |
This fix may have issues if both positive and negative V coordinates exist within the same model
So it turns out the V coordinates were not incrementing (as blender was displaying) but decrementing - so components 0-31 would have UVs of (0.0, 0.0)-(31.0, 0.0), then components 32-63 would have UVs of (0.0, -0.0)-(31.0, -0.0), then 64-95 would be (0.0, -1.0)-(31.0, -1.0) and so on (Assuming the pattern holds, I haven't actually observed a model with more than ~40 components) So to fix it I just took the absolute value of the V coordinate and added 1 to it: -0 maps to 1, -1 maps to 2, and so on. This fix would combine components again if there are positive and negative V coordinates in the same model. I haven't seen that case happen as of yet, so I don't know if its possible |
I haven't tested it with a lot of models so far, but it seems to work quite reliably now. Nice work and thanks again! |
This is a feature I wanted when I extracted the Charger model, so I decided to implement it and share with the community.
Model "components" (just what I call them) are various portions of a model that the game uses for a few purposes, most notably the damage states of different body parts of enemies. At least one way of identifying them is via their UV coordinates - it looks like Arrowhead opted to take advantage of repeating texture coordinates to split the UVs for each component, maybe so when an artist was editing the overlapping portions of the model there wouldn't be so many vertices in the way? Whatever the reason, it gives us an easy way to split the components apart, making it easier to get enemies in a specific damage state in Blender.
With this change, I've added a
unit
config optioncomponents
with valuescombined
(default) andsplit
. Whensplit
is selected, the model will be split into multiple meshes, one for each unique set of UV integer values. The components will be grouped together with a parent node so that they remain organized when imported.This is my first time working with Go, so please let me know if I've committed any cardinal sins with these changes.