playcanvas / editor

Issue tracker for the PlayCanvas Editor
https://playcanvas.com/
158 stars 28 forks source link

GLB Preserve material mapping is not working properly #202

Open FrantzVZ777 opened 4 years ago

FrantzVZ777 commented 4 years ago

I have a complex car model made of 71 materials just for the exterior. I have attributed materials on the json file in the past. and now need to overwrite the source FBX file in order to generate a GLB file. It seems the GLB is only trying to match the the materials specified on the FBX file.

Here below is the

Screenshot 2020-10-30 at 11 34 13 AM

If the materials names are correctly matching the source FBX, then the mapping is working.

However i have made slight changes to the material names and attributed the materials differently on the json file. PROBLEM: when the GLB is generated it not remember the material mapping made on the JSON.

See below the GLB created new materials (i purposely set in green to highlight):

Screenshot 2020-10-30 at 11 31 34 AM

Here below is the JSON file with existing material mapping:

Screenshot 2020-10-30 at 11 31 53 AM

I guess it should not be very difficult to re-link the existing materials to correct mesh instances nodes IDs on the GLB since the json already has the mapping done.,

This is really important to have, because when you have a complex model made of hundreds of material it is very time consuming to go one by one and re-do the mapping (without making mistakes)

yaustar commented 4 years ago

It seems the GLB is only trying to match the the materials specified on the FBX file.

This is correct as it's a new asset. Unfortunately, you will you will have to redo the mappings.

FrantzVZ777 commented 4 years ago

It would be nice to add an extra option (preserve material mapping from json file)

yaustar commented 4 years ago

The issue that during the conversion process, there's no relationship of the JSON from the FBX file. It just converts FBX to GLB.

I reopened the issue as there could be some custom editor code that can be ran in the console to copy the material order and reapply them to the GLB assuming the nodes are in the same order.

FrantzVZ777 commented 4 years ago

That would be nice to have for the time being...

For longer term, some extra option could be integrated here as mentioned above.

Screenshot 2020-10-30 at 4 14 13 PM

preserve material mapping from json file

slimbuck commented 4 years ago

Hi @FrantzVZ777,

Sorry about this, we're working on a fix!

Thanks

yaustar commented 3 years ago

@slimbuck Did we fix this? 😅

yaustar commented 3 years ago

@vkalpias Was this fixed by you?