开发者

Three.js custom textured meshes

开发者 https://www.devze.com 2023-03-29 22:19 出处:网络
Is it possible to add a textured material to an object with a custom mesh in Three.js? Whenever I try exporting an object from Blender to Three.js with a texture on it, the object disappears. Looking

Is it possible to add a textured material to an object with a custom mesh in Three.js?

Whenever I try exporting an object from Blender to Three.js with a texture on it, the object disappears. Looking through the three.js examples, it seems like they've carefully avoided putting textures on anything other than the built-in geometries, and forcing a texture on such a mesh causes it to again disappear.

For example, if I edit scene_test.js, which is a scene file called from webgl_scene_test.html, if I apply 开发者_运维问答the "textured_bg" to the "walt" head, it will disappear.


It looks like the missing piece of the puzzle was that you have to apply the set of UV coordinates to the mesh of the object in question.

First, select your texture, and under "Mapping" make sure that the "coordinates" dropdown is set to "UV"

Then, click on the "object data" button, and in the UV Texture list, click the plus icon. This seems to automatically add the UV data to the mesh.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号