Threejs报错:RGBELoader Bad File Format: bad initial token

原因:加载进来的资源路径报错

加载进来的所有资源,最好放在/public/文件夹下,否则会报错

资源所在位置:
public/textures/hdr/skybox.hdr

      // 加载hdr环境图
      const rgbeLoader = new RGBELoader();
      rgbeLoader.loadAsync("/textures/hdr/skybox.hdr").then((texture) => {
    
    
        texture.mapping = THREE.EquirectangularReflectionMapping;
        scene.background = texture;
        scene.environment = texture;
      });

猜你喜欢

转载自blog.csdn.net/weixin_37064409/article/details/128374749