添加mtl时,Obj文件变为白色

问题描述 投票:0回答:1

我正在用框架写一个剧本来展示地球。但是,当我尝试添加纹理时,它变得全白。

这是我的脚本:

<html>
  <head>
    <div class="navbar">

    </div>
    <!-- aframe itself -->
    <script src="//cdn.rawgit.com/donmccurdy/aframe-extras/v3.13.1/dist/aframe-extras.min.js"></script>
    <script src="https://aframe.io/releases/0.9.0/aframe.min.js"></script>
    <a-scene stats>
        <a-assets>
          <a-asset-item id="earth-obj" src="https://cdn.glitch.com/5995a6f7-2893-46f8-a015-8513de4817c6%2F1227%20Earth.obj?1551999264805"></a-asset-item>
          <a-asset-item id="earth-mtl" src="https://cdn.glitch.com/5995a6f7-2893-46f8-a015-8513de4817c6%2F1227%20Earth.mtl?1552002240966"></a-asset-item>
        </a-assets>

        <!-- Image links. -->
        <a-entity id="links" layout="type: line; margin: 1.5" position="0 -1 -4">
          <a-entity template="src: #link" data-src="#cubes" data-thumb="#cubes-thumb"></a-entity>
          <a-entity template="src: #link" data-src="#city" data-thumb="#city-thumb"></a-entity>
          <a-entity template="src: #link" data-src="#sechelt" data-thumb="#sechelt-thumb"></a-entity>
        </a-entity>
        <a-entity obj-model="obj: #earth-obj; mtl: #earth-mtl" 
                  position="0 1.5 -3"
                  scale="0.05 0.05 0.05">
          <a-animation attribute="rotation"
                       dur="30"
                       to="0 360 0"
                       repeat="indefinite"
                       easing="linear"></a-animation>
        </a-entity>
        <a-entity camera look-controls position="0 1.5 0">
            <a-cursor>
              <a-entity position="0 0 -3" id="weapon">
                <a-box color="blue" width="0.25" height="0.5" depth="3"
                       static-body></a-box>
              </a-entity>
            </a-cursor>
        </a-entity>
      <a-entity environment="shadow: true; shadowSize: 10; preset:default;" ></a-entity>

        <a-plane color="brown" rotation="-90 0 0" 
                 static-body
                 width="100" height="100"></a-plane>

    </a-scene>

  </head>
  <body>
  </body>
</html>

这是.mtl文件

newmtl Mat
    map_Kd Earth.png
usemtl Mat

Earth.png与.obj和.mtl文件位于同一目录中,我不知道该怎么做。

aframe virtual-reality .obj
1个回答
0
投票

您的MTL和纹理不在同一目录中。它们托管在CDN上的各个URL上。故障可能会给你一个幻觉,他们在同一个目录。

© www.soinside.com 2019 - 2024. All rights reserved.