You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

ThreeJS RGBELoader加载HDR文件时出现‘unsupported type: 1009’错误求助

Fixing "THREE.RGBELoader: unsupported type: 1009" Error in Three.js

Let’s work through fixing this issue—I’ve run into similar hiccups after Three.js version upgrades, and this error boils down to a mismatch between how the updated RGBELoader expects to handle HDR data and your current code setup.

Core Fix: Adjust the Data Type

The main problem here is using THREE.UnsignedByteType with RGBELoader. HDR files store high dynamic range information using floating-point values, and UnsignedByteType (an 8-bit integer format) can’t properly interpret that data.

You have two simple, effective fixes:

  1. Remove the setDataType call entirely—RGBELoader will default to a compatible floating-point type (usually THREE.HalfFloatType)
  2. Explicitly set the data type to THREE.HalfFloatType (recommended for consistent behavior across versions)

Here’s the updated code:

// (资产加载器中获取资源路径及.hdr文件url的前置代码)
if (type == 'hdr') {
    new RGBELoader()
        .setDataType(THREE.HalfFloatType) // Replace UnsignedByteType with this
        .setPath( _BASE_ASSET_URL )
        .load( url, function ( loadedItem ) {
            scope.assets[name] = loadedItem
        })
}

Why This Happened

After the version upgrade, RGBELoader added stricter validation for HDR file headers. The "unsupported type: 1009" refers to a header flag that signals the HDR file uses a floating-point format, but your code was telling the loader to expect 8-bit unsigned integers—so it couldn’t parse the file correctly.

Additional Troubleshooting Steps

If the core fix doesn’t resolve the issue, try these checks:

  • Verify your HDR file isn’t corrupted: Re-export it from your 3D tool or test with a known-working HDR file to rule out file damage
  • Check Three.js release notes for RGBELoader changes: Sometimes upgrades introduce new required configuration options
  • Avoid UnsignedByteType for HDR: If you absolutely need an 8-bit format, you’ll have to tone-map the HDR to LDR first (but this defeats the purpose of using HDR for dynamic range)

内容的提问来源于stack exchange,提问作者curmudgeonyprogrammer

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.28 23:23:10