Wildenhaus / Index

A tool for browsing and extracting assets from Halo 2 Anniversary.
16 stars 1 forks source link

Add support for multiple material slots #14

Open Wildenhaus opened 2 years ago

Wildenhaus commented 2 years ago

A user at Halo Archive noticed that some models are using the wrong material/texture in places.

spectre__h Object Name: _lpod_major_body Object Id: 57

Actual: unknown

Expected: unknown

Upon inspection, it looks like the correct material is on Layer1 of the submesh materials image

We're only adding the base material right now, and we're ignoring a lot of data within S3DMaterial that we should probably be applying.

Actions

Wildenhaus commented 2 years ago

I'm not sure if multiple material slots will be viable..

If you export a model with "Export Material Definitions", you'll notice that each material can have multiple layers. Most of the time they're on a different UV channel.

Model formats don't let you have multiple materials on a mesh. It looks like (for at least FBX) meshes that have multiple material slots are actually just stored as separate meshes on the same node.

We can't just split the mesh into parts, because Saber's material layers are UV based, and most of the time there are UV coordinates for multiple layers on each vertex.

What we CAN fix for now is the issue of textures on layer 1-3 not exporting.

Gonna ask the people making the blender shader about this.

Wildenhaus commented 2 years ago

Fixed issue where textures in Layers 1-3 would not export: 8a55f715f1ca07c428b67c59795e10cf2760ef2d

The only solution for now is for the user to see these layer setups in the _materials.json file and manually set them up with add/mix shaders if need be.