MONOGRID / gainmap-js

A Javascript (TypeScript) Port of Adobe Gainmap Technology for storing HDR Images using an SDR Image + a gainmap
https://monogrid.github.io/gainmap-js/
MIT License
70 stars 5 forks source link

Is it possible to use hdrjpg's with Scene.BackgroundRotation and Scene.BackgroundBluriness in threejs? #39

Closed kitaedesigns closed 2 months ago

kitaedesigns commented 2 months ago

I am trying to Rotate and Blur HDR JPG's in threejs 163 but rotation and blur of the scene background when using an HDR JPG doesn't work, only using an .hdr file works. Could be because scene.background uses RGBM Texture Loader as opposed to the normal SDR Texture Loader but not sure.

daniele-pelagatti commented 2 months ago

if you do something like scene.background = result.renderTarget.texture like here, you are setting the background as a renderTarget and then maybe three.js doesn't handle the rotation and blur of a renderTarget. I remember setting an EquirectangularReflectionMapping rendertarget as scene.background wasn't even supported before three r159 so that is entirely plausible given the implementation is quite new.

I suggest you try setting the background with scene.background = result.toDataTexture() which forces the renderTarget data to be read from the GPU, and has a performance overhead but basically should work in any case.

If scene.background = result.toDataTexture() works and scene.background = result.renderTarget.texture doesn't work then I suggest you open a bug report in the three.js repository because that sounds like an implementation problem when an EquirectangularReflectionMapping renderTarget is used as scene.background

kitaedesigns commented 2 months ago

Ok thanks @daniele-pelagatti! I'll try your method and if it doesn't work I'll post a bug report. I tried asking in the Discord but I don't think anyone has tried it yet.

daniele-pelagatti commented 2 months ago

marking this a resolved, feel free to re-open if needed