0
$\begingroup$

I'm trying to export the following scene to JSON:

enter image description here

It is made up of 45 models. Each model will want to have 2-4 different colored faces, like in the picture above.

When I export it in the JSON exporter, I don't get multiple materials per model:

{
            "name":"Corner FTR",
            "uuid":"E83CD01B-9517-3450-B715-1736FABFF4AB",
            "matrix":[-0,0,0.814963,0,0.814963,0,0,0,0,0.814963,0,0,-0.003244,3e-06,0,1],
            "visible":true,
            "type":"Mesh",
            "material":"E323212E-D25C-3E77-B9E9-C7EF768C37B6",
            "castShadow":true,
            "receiveShadow":true,
            "geometry":"3AC1CE35-8D05-3429-9045-B37405F9EBC4"
}

(This is the resultant export code for the corner in the foreground with three colors).

Naturally, when I try to render this in Three.js, the materials don't show, because they didn't export. (In fact, no material shows at all; it seems that material exported is a dud).

If I give a model a single material, everything works fine. The problem only arises when I try to give a single model different materials for different faces.

Any suggestions?

$\endgroup$
1
$\begingroup$

I personally would try one of these two things:

  1. Bake an image for the whole object to be UV wrapped in, and then use that image as one material.

OR

  1. Separate the Meshes per material, and export those out separately with their single materials. I know THREEJS anyway has groups that you could use to re-group all of the geometry, but I'm not sure that's what you are using JSON for.
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.