0

I have an OBJ model that I downloaded from here Hamburger Google Poly. I am using AR.js and A-Frame for loading the model. Here is my code

<!DOCTYPE html>
<html>
    <script src="https://aframe.io/releases/0.7.1/aframe.min.js"></script>
    <script src="https://jeromeetienne.github.io/AR.js/aframe/build/aframe-ar.js"></script>
    <script src="https://rawgit.com/donmccurdy/aframe-extras/master/dist/aframe-extras.loaders.min.js"></script>    
    <body style="margin : 0px; overflow: hidden;">
        <a-scene embedded arjs="sourceType: webcam; trackingMethod: best; debugUIEnabled: false;" antialias="true">

            <a-anchor hit-testing-enabled="true">

                <a-obj-model src="Hamburger.obj" 
                             mtl="Hamburger.mtl"
                             position="0 0.5 0"
                             scale="0.1 0.1 0.1"
                            >
                </a-obj-model>                          
            </a-anchor>
            <a-camera-static/>
        </a-scene>
    </body>
</html>

I am being able to load the model but somehow the texture is not right.It appears blackened out. Blackened loaded Hamburger model

What am I doing wrong? Why does the model not load in correct texture? I have both the .mtl file and the Base color file at the same location.

Syed Saad
  • 705
  • 5
  • 15

1 Answers1

1

As far as i know, formats such as .obj's, .fbx's, or .dae are a bit inconsistent, meaning they won't always work as expected in a-frame.

You should try converting the model to glTF with this exporter, .glTF is a format designed for webGL, and so far i had no issues with it.

It is also recommended by the a-frame team in the docs !

Piotr Adam Milewski
  • 14,150
  • 3
  • 21
  • 42
  • Yeah , its better to export I guess, found a cool drag and drop tool as well for that! http://52.4.31.236/convertmodel.html – Syed Saad Mar 18 '18 at 15:30