pengHTYX / Era3D

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot find the mesh with textures in $OUTPUT_DIR.

qingtingJ opened this issue · comments

This is a amazing project! It helps me a lot! I successfully get the obj file and then I can import it into UE. But I cannot find the mesh with texture? There are some videos and mesh without texture saved in $OUTPUT_DIR.

commented

I suppose that is because the UE does not support the color format of the .obj files that we saved. To fix it, you can try to convert the .obj files to .glb using this code snippet.

from pygltflib import GLTF2, Material, PbrMetallicRoughness
obj = GLTF2().load(obj_path)
obj.meshes[0].primitives[0].material = 0
obj.materials.append(Material(
    pbrMetallicRoughness = PbrMetallicRoughness(
    baseColorFactor = [1.0, 1.0, 1.0, 1.0],
    metallicFactor = 0.,
    roughnessFactor = 1.0,
    ),
    emissiveFactor = [0.0, 0.0, 0.0],
    doubleSided = True,
    ))
obj.save(glb_path)

Optionally, you can visualize the textured obj in Meshlab.

Thank you for your prompt reply! It works!