question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RGBELoader and HDRCubeTextureLoader RGBELoader Bad File Format: bad initial token on REACT

See original GitHub issue
Description of the problem

Hi, I got very strange issue that only appears on react framework when i want to load HDR. Here is link to codesandbox: https://codesandbox.io/s/proud-currying-qr53r

I basesed of example from https://threejs.org/examples/?q=gltf#webgl_loader_gltf, but every time i’m getting this error:

RGBELoader Bad File Format: bad initial token

log.js:24 [HMR] Waiting for update signal from WDS... index.js:1 RGBELoader Bad File Format: bad initial token console.<computed> @ index.js:1 rgbe_error @ RGBELoader.js:55 RGBE_ReadHeader @ RGBELoader.js:152 parse @ RGBELoader.js:413 (anonymous) @ three.module.js:36315 (anonymous) @ three.module.js:35990 load (async) load @ three.module.js:35968 load @ three.module.js:36313 load @ RGBELoader.js:535 Three_initial.sceneSetup @ three_test.js:29 componentDidMount @ three_test.js:9 commitLifeCycles @ react-dom.development.js:22101 commitLayoutEffects @ react-dom.development.js:25344 callCallback @ react-dom.development.js:336 invokeGuardedCallbackDev @ react-dom.development.js:385 invokeGuardedCallback @ react-dom.development.js:440 commitRootImpl @ react-dom.development.js:25082 unstable_runWithPriority @ scheduler.development.js:697 runWithPriority$2 @ react-dom.development.js:12149 commitRoot @ react-dom.development.js:24922 finishSyncRender @ react-dom.development.js:24329 performSyncWorkOnRoot @ react-dom.development.js:24307 scheduleUpdateOnFiber @ react-dom.development.js:23698 updateContainer @ react-dom.development.js:27103 (anonymous) @ react-dom.development.js:27528 unbatchedUpdates @ react-dom.development.js:24433 legacyRenderSubtreeIntoContainer @ react-dom.development.js:27527 render @ react-dom.development.js:27608 ./src/index.js @ index.js:7 __webpack_require__ @ bootstrap:785 fn @ bootstrap:150 1 @ serviceWorker.js:141 __webpack_require__ @ bootstrap:785 checkDeferredModules @ bootstrap:45 webpackJsonpCallback @ bootstrap:32 (anonymous) @ main.chunk.js:1 webpackHotDevClient.js:138 ./src/pages/App.js Line 5:8: 'ThreeInitial' is defined but never used no-unused-vars printWarnings @ webpackHotDevClient.js:138 handleWarnings @ webpackHotDevClient.js:143 push../node_modules/react-dev-utils/webpackHotDevClient.js.connection.onmessage @ webpackHotDevClient.js:210

Without React framework with vanilla JS its work’s fine. I tested HDR loading also with this example https://threejs.org/examples/?q=hdr#webgl_materials_envmaps_hdr, but resault same RGBELoader Bad File Format: bad initial token

I lost 2 days trying to fix this in a lot of different approaches (including changing path) so i decided to post this as an issue.

Does anyone have any idea how to prevent this?

Three.js version
  • [x ] Dev
  • r113
Browser
  • All of them
  • Chrome
  • Firefox
  • Internet Explorer

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
mrdoobcommented, Feb 17, 2020
import HdrFile from "texutes/royal_esplanade_1k.hdr";

That works? 🤔

0reactions
jamintcommented, Jul 14, 2021

Using this method, how do you change the exposure?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Three.js RGBE Loader load HDR with URL - Stack Overflow
Here's the error message: THREE.RGBELoader Bad File Format: bad initial token . I guess I can't just pass the URL but I don't...
Read more >
Error in RGBELoader - Questions - three.js forum
Hi! im trying to load my hdr in promise function: import { RGBELoader } from "three/examples/jsm/loaders/RGBELoader"; export default class Hdr { static ...
Read more >
JSDoc: Source: loader/RGBELoader.js
RGBELoader Bad File Format : " + (msg || ''));; break;; default: case rgbe_memory_error: ... return rgbe_error(rgbe_format_error, "bad initial token"); ...
Read more >
React Three.js 增加hdr环境贴图和背景图片的方法 - CSDN博客
const loader = new RGBELoader(). loader.setDataType(THREE.UnsignedByteType).
Read more >
Environment in react-three-fiber : r/threejs - Reddit
Hi All, I have a HDRI background, saved as garden.hdr and I'm trying to render it, to no avail I'm trying to render...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found