gainmap-js icon indicating copy to clipboard operation
gainmap-js copied to clipboard

Kudos to you - Readme suggestion

Open dghez opened this issue 1 year ago • 2 comments

Not really an issue, just wanted to say thanks for the library, i recently tried with three as envMap lighting and i was able to save like 2mb in filesize. Although I kinda suggest to maybe create and explicit a note on the fact you still need to use PMREMGenerator if you want to use that as environment, otherwise it won't work. I took me a while to realise that, was using directly as envmap eheh

  const pmremGenerator = new PMREMGenerator(gl)
  pmremGenerator.compileEquirectangularShader()

  const loader = new HDRJPGLoader(gl)
  loader.loadAsync('..../lighting.jpg').then(res => {
    const envMap = pmremGenerator.fromEquirectangular(res.renderTarget.texture).texture
    scene.value.environment = envMap
  })

Anyway, thanks again ❤️

dghez avatar Apr 23 '24 14:04 dghez

Hello! Thanks for your kind words.

Regarding your problem, have you tried doing something like

const loader = new HDRJPGLoader(gl)
    .setRenderTargetOptions({ mapping: EquirectangularReflectionMapping }) // <------- see here
    
scene.environment = ( await loader.loadAsync('..../lighting.jpg') ).renderTarget.texture

last time I checked this worked, but then again three.js constantly changes with time so I could be entirely wrong :smile:

daniele-pelagatti avatar Apr 24 '24 15:04 daniele-pelagatti

Kinda already closed that project and handed the files but I'll try asap or in the next project I'll need a envmap and I'll update you! ❤️

dghez avatar Apr 25 '24 15:04 dghez

closing due to inactivity

daniele-pelagatti avatar Jul 29 '24 07:07 daniele-pelagatti