Here is my code:
rgbeLoader.load('venice_sunset_1k.hdr', (texture)=>{
const rt = new THREE.WebGLCubeRenderTarget(texture.image.height);
rt.fromEquirectangularTexture(renderer, texture);
const cubeTexture = rt.texture;
console.log(cubeTexture.image);
lightProbe.copy(LightProbeGenerator.fromCubeTexture(cubeTexture));
});
I use RGBELoader
to load .hdr
equirectangular texture, and generate a cube texture through WebGLCubeRenderTarget
. Then use the static methods fromCubeTexture
of LightProbeGenerator
to generate a light probe, but I got an error:
Uncaught (in promise) TypeError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The provided value is not of type '(CSSImageValue or HTMLCanvasElement or HTMLImageElement or HTMLVideoElement or ImageBitmap or OffscreenCanvas or SVGImageElement or VideoFrame)'.
In fromCubeTexture
method, it will use the image
, but the image
value is not an instance of HTMLImageElement
:
// ...
const image = cubeTexture.image[ faceIndex ];
// ...
context.drawImage( image, 0, 0, width, height );
// ...
Is there any solution?