Skip to content
Advertisement

Three js hdr turns off but never back on

I’m trying to turn on and off a hdr map in three js.

This is how I create it

JavaScript

})

So far so good.

I then add it to the gui:

JavaScript

Finally, I try to specify the on/off logic, but when I read the console logs, it’s always printing ‘false’

JavaScript

Note that the hdr loads correctly, turns off correctly when I click the switch button, but never turns on again.

Advertisement

Answer

Try to write your updateHdr function like so:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement