dolfinus / 3DAlloy

LightWeight 3D-viewer for MediaWiki
MIT License
3 stars 4 forks source link

Empty Viewport for OBJ files. #1

Closed KTBL-AlonRichter closed 2 years ago

KTBL-AlonRichter commented 2 years ago

When adding an obj file, the resulting viewport becomes empty. This is true when using local files and linked URLs from other sites.

dolfinus commented 2 years ago

Hi.

Could you please give an example?

KTBL-AlonRichter commented 2 years ago

Sure, thank you.

image This is the empty viewport I am receiving. My obj file is relatively simple, I'm receiving the same error when using off-site .obj files. I double and triple-checked the files themselves, they work well in other programs.
I also receive an error message in the console:

Uncaught TypeError: Cannot read property 'color' of undefined at load.php?lang=de&modules=ext.3DAlloy|jquery&skin=vector&version=1ocmk:631 at THREE.Mesh.traverse (load.php?lang=de&modules=ext.3DAlloy|jquery&skin=vector&version=1ocmk:105) at THREE.Group.traverse (load.php?lang=de&modules=ext.3DAlloy|jquery&skin=vector&version=1ocmk:105) at Object3D.load_obj (load.php?lang=de&modules=ext.3DAlloy|jquery&skin=vector&version=1ocmk:631) at load.php?lang=de&modules=ext.3DAlloy|jquery&skin=vector&version=1ocmk:632 at load.php?lang=de&modules=ext.3DAlloy|jquery&skin=vector&version=1ocmk:602 at XMLHttpRequest.<anonymous> (load.php?lang=de&modules=ext.3DAlloy|jquery&skin=vector&version=1ocmk:203)

The obj file used is this (I cannot upload .obj files in the comments here): # Blender v2.93.1 OBJ File: ''# www(dot)blender(dot)org mtllib cubes.mtl o Cube v 1.000000 1.000000 -1.000000 v 1.000000 -1.000000 -1.000000 v 1.000000 1.000000 1.000000 v 1.000000 -1.000000 1.000000 v -1.000000 1.000000 -1.000000 v -1.000000 -1.000000 -1.000000 v -1.000000 1.000000 1.000000 v -1.000000 -1.000000 1.000000 vt 0.625000 0.500000 vt 0.875000 0.500000 vt 0.875000 0.750000 vt 0.625000 0.750000 vt 0.375000 0.750000 vt 0.625000 1.000000 vt 0.375000 1.000000 vt 0.375000 0.000000 vt 0.625000 0.000000 vt 0.625000 0.250000 vt 0.375000 0.250000 vt 0.125000 0.500000 vt 0.375000 0.500000 vt 0.125000 0.750000 vn 0.0000 1.0000 0.0000 vn 0.0000 0.0000 1.0000 vn -1.0000 0.0000 0.0000 vn 0.0000 -1.0000 0.0000 vn 1.0000 0.0000 0.0000 vn 0.0000 0.0000 -1.0000 usemtl Material s off f 1/1/1 5/2/1 7/3/1 3/4/1 f 4/5/2 3/4/2 7/6/2 8/7/2 f 8/8/3 7/9/3 5/10/3 6/11/3 f 6/12/4 2/13/4 4/5/4 8/14/4 f 2/13/5 1/1/5 3/4/5 4/5/5 f 6/11/6 5/10/6 1/1/6 2/13/6 o Cube.001 v 1.000000 1.000000 -2.458512 v 1.000000 -1.000000 -2.458512 v 1.000000 1.000000 -0.458512 v 1.000000 -1.000000 -0.458512 v -1.000000 1.000000 -2.458512 v -1.000000 -1.000000 -2.458512 v -1.000000 1.000000 -0.458512 v -1.000000 -1.000000 -0.458512 vt 0.625000 0.500000 vt 0.875000 0.500000 vt 0.875000 0.750000 vt 0.625000 0.750000 vt 0.375000 0.750000 vt 0.625000 1.000000 vt 0.375000 1.000000 vt 0.375000 0.000000 vt 0.625000 0.000000 vt 0.625000 0.250000 vt 0.375000 0.250000 vt 0.125000 0.500000 vt 0.375000 0.500000 vt 0.125000 0.750000 vn 0.0000 1.0000 0.0000 vn 0.0000 0.0000 1.0000 vn -1.0000 0.0000 0.0000 vn 0.0000 -1.0000 0.0000 vn 1.0000 0.0000 0.0000 vn 0.0000 0.0000 -1.0000 usemtl Material.001 s off f 9/15/7 13/16/7 15/17/7 11/18/7 f 12/19/8 11/18/8 15/20/8 16/21/8 f 16/22/9 15/23/9 13/24/9 14/25/9 f 14/26/10 10/27/10 12/19/10 16/28/10 f 10/27/11 9/15/11 11/18/11 12/19/11 f 14/25/12 13/24/12 9/15/12 10/27/12

The mtl: `# Blender MTL File: 'None'# Material Count: 2

newmtl Material Ns 323.999994 Ka 1.000000 1.000000 1.000000 Kd 0.001226 0.000000 0.800000 Ks 0.500000 0.500000 0.500000 Ke 0.000000 0.000000 0.000000 Ni 1.450000 d 1.000000 illum 2

newmtl Material.001 Ns 323.999994 Ka 1.000000 1.000000 1.000000 Kd 0.800000 0.023367 0.013294 Ks 0.500000 0.500000 0.500000 Ke 0.000000 0.000000 0.000000 Ni 1.450000 d 1.000000 illum 2`

dolfinus commented 2 years ago

Could you please attach file somewhere else (e.g. Dropbox or Google Drive) and provide a link?