0

I just started with ar.js for my presentation and got in problem with one of my model loading, I can see only cube on my screen. While with other model it is actually there( second code ).

Tried with different scale factors and all is the same, different model and its ok.

Model that Im tring to get is loading normal on computer program that opens .obj could size of model be problem, .obj is around 35Mb.

<script src="https://aframe.io/releases/0.6.0/aframe.min.js"></script>

<script src="https://jeromeetienne.github.io/AR.js/aframe/build/aframe-ar.js"></script>
<body style='margin : 0px; overflow: hidden;'>
  <a-scene embedded arjs>
   
  <a-assets>
    <a-asset-item id="tree-obj" src="https://raw.githubusercontent.com/Kanu-1988/ar.js/master/namtalica2.obj"></a-asset-item>
    <a-asset-item id="tree-mtl" src="https://raw.githubusercontent.com/Kanu-1988/ar.js/master/namtalica2.mtl"></a-asset-item>
  </a-assets>

  <a-entity obj-model="obj: #tree-obj; mtl: #tree-mtl"
            <a-entity scale="0.01 0.01 0.01"></a-entity>
  
            ></a-entity>

    <a-marker-camera preset='hiro'></a-marker-camera>
<a-marker type='pattern' url='http://examples.org/hiro.patt'></a-marker>

  </a-scene>
</body>

Code that works is with

  <a-assets>
<a-asset-item id="tree-obj" src="https://raw.githubusercontent.com/Kanu-1988/kanu/master/rezac2.obj"></a-asset-item>
<a-asset-item id="tree-mtl" src="https://raw.githubusercontent.com/Kanu-1988/kanu/master/rezac2.mtl"></a-asset-item>
  </a-assets>
Kanu1988
  • 1
  • 1

2 Answers2

0

models load much more reliably as .gltf format. download the obj model and convert it to gltf format. There are many converters online. Here is one: https://www.khronos.org/news/permalink/new-drag-and-drop-to-convert-obj-models-to-gltf

place the gltf file on your server and use that url in your a-assets file.

Your original obj file looks like it might be inside of a js file. Kanu-1988/ar.js/master/namtalica2.obj

ar.js could be a bad file path that is being parsed as a js file.

Thomas Williams
  • 842
  • 6
  • 13
0

Thanks guys for the reply, managed to "get" model, it was off center so it was outside camera range, scale it a bit more in blender and now is in range, have to centered it a bit more and planning to add rotate and zoom function.

this is how it looks now

Here is current code:

<a-assets>
<a-asset-item id="tree-obj" src="https://raw.githubusercontent.com/Kanu-1988/T2/master/u5.obj"></a-asset-item>
<a-asset-item id="tree-mtl" src="https://raw.githubusercontent.com/Kanu-1988/T2/master/u5.mtl"></a-asset-item>

Kanu1988
  • 1
  • 1