SketchUp的出口OBJ与纹理 - 如何 [英] SketchUp export obj with textures - how

查看:310
本文介绍了SketchUp的出口OBJ与纹理 - 如何的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

的Windows 7(64位),SketchUp的制作13.0.4812。

Windows 7 (64bit), SketchUp Make 13.0.4812.

目标:的SketchUp .skp模式转换为 .OBJ 和负载的WebGL使用three.js

Goal: convert SketchUp .skp model to .obj and load to WebGL using three.js.

问题:的SketchUp的出口模式, .OBJ 与外部的纹理,这些纹理不会被three.js加载

Problem: sketchup exports model to .obj with external textures, and these textures are not loaded by three.js.

问:是有可能的SketchUp模型保存为一个 .OBJ 文件与纹理

Question: is it possible to save SketchUp model as one .obj file with textures?

推荐答案

没有,.OBJ是一个简单的文本格式。你不能存储纹理的.obj。  这里有一个例子,了解如何从一个单独的.jpg文件加载纹理。

No, .obj is a simple text format. You can't store textures in .obj. Here is an example on how to load the texture from a separate .jpg file.

我复制了重要的位:

// texture
var manager = new THREE.LoadingManager();
manager.onProgress = function ( item, loaded, total ) {
  console.log( item, loaded, total );
};
var texture = new THREE.Texture();
var loader = new THREE.ImageLoader( manager );
loader.load( 'textures/ash_uvgrid01.jpg', function ( image ) {
  texture.image = image;
  texture.needsUpdate = true;
} );

// model
var loader = new THREE.OBJLoader( manager );
loader.load( 'obj/male02/male02.obj', function ( object ) {
  object.traverse( function ( child ) {
    if ( child instanceof THREE.Mesh ) {
      child.material.map = texture;
    }
    scene.add( object );
  });
});

这篇关于SketchUp的出口OBJ与纹理 - 如何的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆