zoukankan      html  css  js  c++  java
  • THREE.JS + Blender(obj、mtl加载代码)

    2016-11-04  09:23:17

    THREE.REVISION  "81dev"  Blender     “2.78”

    1、加载OBJ、MTL文件

     1 //        THREE.Loader.Handlers.add(/.dds$/i, new THREE.DDSLoader() );
     2         var mtlLoader = new THREE.MTLLoader();
     3         mtlLoader.setBaseUrl('libs/obj/');
     4         mtlLoader.setPath('libs/obj/');
     5 
     6         mtlLoader.load('Tree2.mtl', function(materials){
     7             materials.preload();
     8             //model
     9             var objLoader = new THREE.OBJLoader();
    10             objLoader.setMaterials(materials);
    11             objLoader.setPath('libs/obj/');
    12             objLoader.load('Tree2.obj',function(object){
    13 //                object.traverse(function(child){
    14 //                    child.material.side = THREE.DoubleSide;
    15 //                });
    16                 object.position.y = 0;
    17                 object.scale.set(4,4,4);
    18                 scene.add(object);
    19 
    20             },onProgress, onError);
    21         });

    效果:

    2、Blender Add-ons

    Sapling Tree Gen可以直接搜索到

    SCA Tree Generator 下载地址:https://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Add_Mesh/Add_Space_Tree

    在Blender中Shift+A快捷键可以查看是否安装成功

  • 相关阅读:
    SQLI DUMB SERIES-12
    SQLI DUMB SERIES-11
    SQLI DUMB SERIES-9&&10
    SQLI DUMB SERIES-8
    SQLI DUMB SERIES-7
    XXS level10
    XXS level9
    XXS level8
    XXS level7
    XXS level6
  • 原文地址:https://www.cnblogs.com/custer/p/6029154.html
Copyright © 2011-2022 走看看