{"record":{"id":"7275ed0817a44aa1","repo":"mrdoob/three.js","slug":"three-pmremgenerator-fromequirectangular-calle","errorCode":null,"errorMessage":"THREE.PMREMGenerator: .fromEquirectangular() called before the backend is initialized. Use \"await renderer.init();\" before using this method.","messagePattern":"THREE\\.PMREMGenerator: \\.fromEquirectangular\\(\\) called before the backend is initialized\\. Use \"await renderer\\.init\\(\\);\" before using this method\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/renderers/common/extras/PMREMGenerator.js","lineNumber":217,"sourceCode":"\n\t}\n\n\t/**\n\t * Generates a PMREM from an equirectangular texture, which can be either LDR\n\t * or HDR. The ideal input image size is 1k (1024 x 512), as this matches best\n\t * with the 256 x 256 cubemap output. The minimum supported input image size\n\t * is 64 x 32.\n\t *\n\t * @param {Texture} equirectangular - The equirectangular texture to be converted.\n\t * @param {?RenderTarget} [renderTarget=null] - The render target to use.\n\t * @return {RenderTarget} The resulting PMREM.\n\t * @see {@link PMREMGenerator#fromEquirectangularAsync}\n\t */\n\tfromEquirectangular( equirectangular, renderTarget = null ) {\n\n\t\tif ( this._hasInitialized === false ) {\n\n\t\t\tthrow new Error( 'THREE.PMREMGenerator: .fromEquirectangular() called before the backend is initialized. Use \"await renderer.init();\" before using this method.' );\n\n\t\t}\n\n\t\treturn this._fromTexture( equirectangular, renderTarget );\n\n\t}\n\n\t/**\n\t * Generates a PMREM from an equirectangular texture, which can be either LDR\n\t * or HDR. The ideal input image size is 1k (1024 x 512),\n\t * as this matches best with the 256 x 256 cubemap output.\n\t *\n\t * @deprecated\n\t * @param {Texture} equirectangular - The equirectangular texture to be converted.\n\t * @param {?RenderTarget} [renderTarget=null] - The render target to use.\n\t * @return {Promise<RenderTarget>} The resulting PMREM.\n\t * @see {@link PMREMGenerator#fromEquirectangular}\n\t */","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/mrdoob/three.js/blob/da05705fa31f02710c19772a2aa70c7454807f0c/src/renderers/common/extras/PMREMGenerator.js#L199-L235","documentation":"Thrown by PMREMGenerator.fromEquirectangular() when the renderer is not yet initialized. The method converts an equirectangular texture into a PMREM cubemap, which requires the GPU backend; _hasInitialized delegates to renderer.hasInitialized().","triggerScenarios":"Calling `pmrem.fromEquirectangular(equirectTexture)` on a PMREMGenerator whose renderer has not yet had `await renderer.init()` resolve. Typical in HDR environment loading flows.","commonSituations":"Loading an HDR/equirect environment with RGBELoader then converting to PMREM at startup. Migrating from the deprecated fromEquirectangularAsync without the explicit init await. Code that ran under older synchronous-init versions.","solutions":["Call `await renderer.init();` before `pmrem.fromEquirectangular(tex)`.","Use the deprecated `await pmrem.fromEquirectangularAsync(tex)` (inits internally).","Ensure the input texture is itself initialized (renderer.initTexture) and the renderer is initialized before PMREM conversion."],"exampleFix":"// before\nconst renderer = new WebGPURenderer();\nconst pmrem = new PMREMGenerator(renderer);\nconst envMap = pmrem.fromEquirectangular(hdrTexture); // throws\n\n// after\nconst renderer = new WebGPURenderer();\nawait renderer.init();\nconst pmrem = new PMREMGenerator(renderer);\nconst envMap = pmrem.fromEquirectangular(hdrTexture);","handlingStrategy":"validation","validationCode":"async function safeFromEquirect(pmrem, tex) {\n  if (!pmrem._renderer.hasInitialized()) await pmrem._renderer.init();\n  return pmrem.fromEquirectangular(tex);\n}","typeGuard":"function pmremReady(pmrem) {\n  return pmrem._renderer && typeof pmrem._renderer.hasInitialized === 'function' && pmrem._renderer.hasInitialized();\n}","tryCatchPattern":"try {\n  return pmrem.fromEquirectangular(tex);\n} catch (e) {\n  if (/fromEquirectangular\\(\\) called before/.test(e.message)) { await pmrem._renderer.init(); return pmrem.fromEquirectangular(tex); }\n  else throw e;\n}","preventionTips":["Await renderer.init() before any PMREM conversion.","When loading HDR with RGBELoader, perform the PMREM step in a post-init async phase.","Gate with renderer.hasInitialized() in your environment-loading helper."],"tags":["webgpu","lifecycle","async-init","pmrem","environment-map","equirectangular"],"backgroundTag":null,"analyzedSha":"da05705fa31f02710c19772a2aa70c7454807f0c","analyzedAt":"2026-08-12T22:51:37.160Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}