webvr - Aframe - how to load textures for obj? -


i'm trying load .obj has several .jpgs textures. .obj rendering - without applying material.

the .mtl looks like

newmtl material_0 ka 0.200000 0.200000 0.200000 kd 1.000000 1.000000 1.000000 ks 1.000000 1.000000 1.000000 tr 1.000000 illum 2 ns 0.000000 map_kd tex_0.jpg 

i assume path .jpgs correct - if change it, see 404 errors in console.

my aframe code is:

 <a-scene>     <a-assets>            <a-asset-item id="moore-obj" src="obj/moore.obj"></a-asset-item>            <a-asset-item id="moore-mtl" src="obj/moore.obj.mtl"></a-asset-item>      </a-assets>      <a-entity           obj-model="obj: #moore-obj; mtl: #moore-mtl"           scale="1 1 1"           rotation="0 0 0"           position="1 1 1"></a-entity>  </a-scene> 

the 3d model appears in scene - there no textures overlayed on it. i'm running on localhost, , i'm not seeing cors warnings.

the object http://www.thingiverse.com/thing:36415

turns out issue particular obj file. uses 3 materials doesn't define object groups sub-objects use each of materials, three.js' objloader doesn't associate materials correctly.

you can work around adding group lines before each usemtl line in obj file.

for example:

g g_0 usemtl material_0 ... g g_1 usemtl material_1 

etc.


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -