Maniphest T66709

Material ID instead of Materials in use
Closed, Archived

Assigned To
Sybren A. Stüvel (sybren)
Authored By
Emerson Rosa (e1412)
Jul 11 2019, 3:55 PM
Tags
  • BF Blender
Subscribers
Emerson Rosa (e1412)
Lucas Leme (lucasleme)
Nathan Letwory (jesterking)
Sybren A. Stüvel (sybren)

Description

System Information
Operating system: Windows 10
Graphics card: GTX 1070

Blender Version
2.80 Beta, 700346d377dd, 2019-03-30 19:37

Short description
Missing "material slots" or "material id number" inside Blender.

Full explanation
I'll give an example to explain the bug/issue:

I have a geometry inside Unreal Engine with 10 material slots/ids:

  • 9 slots are using the same material (Ex.: Material01)
  • the remaining slot is using a different one (Ex.: Material02)

Each of the 10 slots affect a different part of the mesh which I may have to modify. When I export that mesh and import in Blender, it only shows two materials (Material01 and Material02), so I can't access the different areas of the model (from the 10 different IDs/Slots). If I import that same FBX in 3DSMax, for instance, it will show all the slots regardless of the material being the same or not.

In short: It would be nice to have a way to access that "Polygon's Material ID" information inside Blender, not just the different materials applied to a given geometry.

I've attached a FBX as an example. It has 6 different material IDs but only 2 different materials applied. In Blender it only shows both the different materials.

Event Timeline

Emerson Rosa (e1412) created this task.Jul 11 2019, 3:55 PM
Sybren A. Stüvel (sybren) lowered the priority of this task from 90 to 30.Jul 11 2019, 4:31 PM
Sybren A. Stüvel (sybren) added a subscriber: Sybren A. Stüvel (sybren).

This looks like a feature request (support material IDs rather than just materials) for the FBX importer; not sure though, could be considered a bug. At least re-test it with the latest build of Blender 2.80 from https://builder.blender.org/download/.

Emerson Rosa (e1412) added a comment.EditedJul 11 2019, 6:55 PM

Hey, Sybren!

Just tested with the latest version and the issue is still there. It's not just for FBX files, I tested with OBJ as well and it seems that Blender "merges" equal materials into the same ID (exporting back to Unreal from Blender (for instance), all the different Slots are gone, and just the unique material IDs remain). Using the same example above, instead of keeping 10 material slots, it comes back from Blender with just 2.

It could be indeed considered a feature request, if you think it fits better that way! How can I do that?

Lucas Leme (lucasleme) added a subscriber: Lucas Leme (lucasleme).Jul 12 2019, 3:34 PM
Emerson Rosa (e1412) raised the priority of this task from 30 to 90.Jul 15 2019, 3:07 PM
Sybren A. Stüvel (sybren) changed the task status from Unknown Status to Unknown Status.Jul 16 2019, 3:42 PM
Sybren A. Stüvel (sybren) claimed this task.

@Emerson Rosa (e1412) You can discuss new features at https://blender.community/c/rightclickselect. There you can discuss ideas with others, and flesh them out so that they're in such a detailed state that a developer can pick them up and work on an implementation without having too many open ends to think about.

Nathan Letwory (jesterking) added a subscriber: Nathan Letwory (jesterking).Jul 29 2019, 9:29 AM

@Emerson Rosa (e1412) Did you test importing the FBX and OBJ files back into Unreal? Do the material indices survive the roundtrip?

From the files you linked to in https://blender.community/c/rightclickselect/4ydbbc/#5d2ed47dd3ac8b621cede009 I have a hard time seeing it could actually work, especially for the OBJ format, but also really for FBX.

Emerson Rosa (e1412) added a comment.Jul 29 2019, 3:12 PM
In T66709#738239, @Nathan Letwory (jesterking) wrote:

@Emerson Rosa (e1412) Did you test importing the FBX and OBJ files back into Unreal? Do the material indices survive the roundtrip?

From the files you linked to in https://blender.community/c/rightclickselect/4ydbbc/#5d2ed47dd3ac8b621cede009 I have a hard time seeing it could actually work, especially for the OBJ format, but also really for FBX.

Hey, Nathan! It seems it doesn't survive the roundtrip indeed. Just exporting and reimporting to Unreal and the IDs are merged. But the thing is that 3DSMax is able to get that information from the FBX somehow. If only there was a way to export from Unreal in the ASCII format to check it :T

Unreal just exports in FBX, maybe the OBJ doesn't support that "instanced" information. As I mentioned on the other link, I think it makes sense for the FBX to use this section for the IDs:

LayerElementMaterial: 0 {
Version: 101
Name: ""
MappingInformationType: "ByPolygon"
ReferenceInformationType: "IndexToDirect"
Materials: *12 {
a: 0,0,0,0,1,1,2,2,3,3,4,4
}
}

That cube has 12 triangles, so each of those numbers (from 0 to 4 - probably refering to the 5 materials applied (I said 6 by mistaken)) may be linked to the order of polygons inside the FBX. I think that's the "Material ID" location inside the file.