Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Export from Blender to Three js with Textures

How can I export to Three.js with json format from Blender with Textures? If i check the checkbox "textures" my json file wont load to browser. Here is how my materials looks like with textures checkbox "materials": [{ "transparent": false, "DbgIndex": 0, "mapDiffuseRepeat": [1,1], "mapDiffuseAnisotropy": 1, "specularCoef": 50, "colorEmissive": [0,0,0], "colorDiffuse": [0.64,0.64,0.64], "wireframe": false, "visible": true, "blending": "NormalBlending", "DbgColor": 15658734, "mapDiffuse": "w.jpg", "DbgName": "Material.005", "opacity": 1, "depthWrite": true, "mapDiffuseWrap": ["RepeatWrapping","RepeatWrapping"], "depthTest": true, "shading": "phong", "colorSpecular": [0.5,0.5,0.5], "colorAmbient": [0.64,0.64,0.64] },...

If I don't it won't load textures but will load the object and here is my materials

"materials": [{
    "blending": "NormalBlending",
    "specularCoef": 50,
    "colorEmissive": [0,0,0],
    "DbgName": "Material.005",
    "colorDiffuse": [0.64,0.64,0.64],
    "DbgIndex": 0,
    "opacity": 1,
    "colorSpecular": [0.5,0.5,0.5],
    "shading": "phong",
    "wireframe": false,
    "colorAmbient": [0.64,0.64,0.64],
    "depthTest": true,
    "transparent": false,
    "visible": true,
    "depthWrite": true,
    "DbgColor": 15658734
},...

Here is my json loader

    loader.load('oddo.js', function(geometry, materials) {
        mesh = new THREE.Mesh(geometry, new THREE.MeshFaceMaterial(materials));
        mesh.scale.x = x;
        mesh.scale.y = y;
        mesh.scale.z = z;
        mesh.opacity=1;
        var model = new THREE.Object3D();
        model.add(mesh);
        model.position.set(0,0,0);
        //mesh.translation = THREE.GeometryUtils.center(geometry);
        group.add(model);
    });

and here is an image from blender object and exporter

Thank you!

like image 464
Iraklis Bekiaris Avatar asked Oct 24 '25 15:10

Iraklis Bekiaris


1 Answers

To whom it may concern

The solution for me is:

  1. In blender turn your object from "object mode" to "edit mode"
  2. Press "u"
  3. Select "Smart UV Project"
  4. Press ok
  5. Check the options in my image
like image 117
Iraklis Bekiaris Avatar answered Oct 26 '25 05:10

Iraklis Bekiaris



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!