how to add texture to the GLB file for the 3D Model using @viro-community/react-viro

Viewed 25

I tried the below code to add texture to the OBJ file it's working fine but it's not working with the GLB file so how to add texture to the GLB file for the 3D Model using @viro-community/react-viro.

This is a 3D object

<Viro3DObject
            source={require("./object_car.glb")}
            position={[0, 1, 0]}
            scale={[0.3, 0.3, 0.3]}
            type="GLB"
            lightReceivingBitMask={3}
            shadowCastingBitMask={2}
            transformBehaviors={["billboardY"]}
            materials={data.texture}
            onClick={_toggleButtons}
            rotation={[50, 50, -10]}
          />

This is texture

ViroMaterials.createMaterials({
    white: {
       lightingModel: "PBR",
      diffuseTexture: require("./object_car_main_Base_Color.png"),
    },
    blue: {
      lightingModel: "PBR",
      diffuseTexture: require("./object_car_main_Base_Color_blue.png"),
    },
  });
0 Answers
Related