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
83 stars 5 forks source link

sdrJPEG from Loader for custom shader skybox #14

Closed arpu closed 11 months ago

arpu commented 11 months ago

Hi,

i trying to add this fantastic gainmaps to a custom skyshader ( sdJPEG) https://github.com/mrxz/fern-aframe-components/blob/main/sky-background/src/index.js

the problem is the generated sd Texture, has generated mipmaps and there are visual Seams

what i doing now is:

 const result = await hdrjpgLoader.loadAsync(this.data.textureSrc);
 let sd = result._quad.material.sdr;
 sd.generateMipmaps = false;
 sd.needsUpdate = true;
 let texture = result.renderTarget.texture;
 result.dispose();

using the sd for the custom shader map value and the texture for the Scene environment, this works but not sure if there is a better way? ( or are the mipmaps needed on the sd Texture in the gainmap Material ? )

daniele-pelagatti commented 11 months ago

hi! Thanks for reaching out!

Out of curiosity: the SDR texture is intended for internal usage and we imagined would not be consumed externally, is there a use case why you are trying to reference it? All in all, this is just the normal JPEG file which you could load with a normal TextureLoader

on to your specific problem: all the internally used texture don't specifically need generateMipmaps: we just assumed it would not cause any problems but I can see it maybe this will cause problems for someone, maybe even related to #15

I'm working on a solution where the library will not generate them by default and you will need to explicitly enable them, also, in general, the library will assume a more 'un-opinionated' stance regarding the output texture options. see #17

daniele-pelagatti commented 11 months ago

try version 3.0.0 and let me know if it solves your problem! thanks!