如何将立方体贴图纹理应用于A帧中的柱面?

时间:2017-11-06 16:56:58

标签: aframe webvr

我正在尝试将不同的图像应用到圆柱体的各个侧面。我已经尝试使用如here所述的立方体贴图方法,但它不起作用。这有用吗?或者是否有另一种方法可以将多个图像添加到此形状中?了解如何将不同的图像添加到各种形状的不同侧面,或者这仅适用于立方体,这将是一件好事吗? 这是我正在尝试的;

<html>
<head>
    <title>example</title>
    <meta name="description" content="Hello, WebVR! - A-Frame">
    <script src="https://aframe.io/releases/0.7.0/aframe.min.js"></script>
    <script src="https://unpkg.com/aframe-template-component@^3.1.1/dist/aframe-template-component.min.js"></script>
</head>
<body>
    <a-scene>
        <a-assets>
                 <a-cubemap id="wheel">
                    <img src="https://www.nickritchie.co.uk/samples/tyre.png">
                    <img src="https://www.nickritchie.co.uk/samples/tyre.png">
                    <img src="https://www.nickritchie.co.uk/samples/wheel.jpg">
                    <img src="https://www.nickritchie.co.uk/samples/wheel.jpg">
                    <img src="https://www.nickritchie.co.uk/samples/tyre.png">
                    <img src="https://www.nickritchie.co.uk/samples/tyre.png">
                  </a-cubemap>
                <script id="example" type="text/html">
                        <a-entity
                            geometry="primitive: cylinder; radius: 0.25; height: 2"
                            position="0 1 -4"
                            rotation="0 0 90"
                            material="envMap: #wheel">
                        </a-entity> 
                </script>
        </a-assets>
        <a-entity 
            template="src: #example">
        </a-entity>
        <a-plane 
            position="0 0 -4" 
            rotation="-90 0 0" 
            width="4"
            height="4" 
            shadow 
            color="yellow">
            </a-plane>
          <a-sky 
            color="grey">
            </a-sky>
          <a-camera>
          </a-camera>
    </a-scene>
</body>

</html>

错误来自three.js,如果有帮助我可以在这里发帖

感谢您的帮助

1 个答案:

答案 0 :(得分:1)

尝试https://github.com/bryik/aframe-cubemap-component

  <a-entity cubemap="folder: https://www.nickritchie.co.uk/samples/"></a-entity>