正确使用三个JS导出器和JSON加载器 [英] Using Three JS exporter and JSON loader correctly

查看:126
本文介绍了正确使用三个JS导出器和JSON加载器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最初,模型甚至都没有加载,但我已修复,所以现在的问题是如何将模型导出到包含文件中纹理的js文件中.

Originally models didn't even load but I fixed that so now the question is how to export models into js file with textures included in the file.

ThreeJSExporter.ms 导出器位于 three.js-master \ utils \ exporters \ max 中,旨在将3d模型从3ds max导出到* .js文件. .它将向3ds max添加一个窗口(请参见屏幕截图),该窗口可以导出到* .js.

The ThreeJSExporter.ms exporter is located in three.js-master\utils\exporters\max, designed to export 3d models from 3ds max to *.js files. It adds to 3ds max a window (see screenshot) which exports into *.js.

ThreeJSExporter.ms窗口:

如窗口所示,它导出为 three.js ASCII JSON格式.由于某些原因,这些导出的文件不包含纹理.它们中的漫反射颜色仅包含颜色信息,而文件中没有纹理.

As the window says it exports to three.js ASCII JSON format. For some reason these exported files don't have textures included. Diffuse color in them includes only color info, no textures in the files.

我通过以下方式加载* .js模型:

I load my *.js models this way:

var loader = new THREE.JSONLoader(), aMesh;
        loader.load("resources/models/model_flipYZ.js", function (geometry, materials) {
            aMesh = new THREE.Mesh(geometry, materials[0]);
            scene.add(aMesh);
        });

问题

1)js模型文件不包含纹理.因此显示了模型,但根本没有纹理.如何在js模型中包含纹理?

1) The js model file does not contain the texture. So the model is displayed but no textures at all. How to include the texture in the js model?

推荐答案

我自己找到了答案.需要在3DS Max中渲染所有纹理,包括Alpha,背景,过程纹理以及您在平面中拥有的所有纹理.因此,在材质编辑器中,对您的纹理或合成纹理使用实用工具-渲染贴图",将其渲染为平面图像并保存.然后制作新材料,为其分配新的平面纹理,将其分配给模型,然后将此模型导出到* .js文件.

I found the answer myself. It is required to render all textures in 3DS Max including alpha, background, procedural textures and whatever you have there into a flat texture. So in material editor use Utilities - Render Map for your textures or for a composite texture if you have it, render it into a flat image and save. Then make a new material, assign this new flat texture to it, assign it to the model and then export this model to a *.js file.

这篇关于正确使用三个JS导出器和JSON加载器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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