2

So I saw an old post here:

https://discourse.threejs.org/t/is-there-a-way-to-increase-scene-environment-map-exposure-without-affecting-unlit-materials/13458/4

That says... "If you apply the env map to Scene.environment, it is automatically used as the environment map for all physical materials in the scene (assumed the material’s envmap is not set)."

So tried this using an Aframe component on the scene:

AFRAME.registerComponent('setenvironment', {
  init: function () {
    var sceneEl = this.el;
    var loader = new THREE.CubeTextureLoader();
    loader.setPath('./');

    var textureCube = loader.load([
      './images/py.png', './images/pz.png',
      './images/nx.png', './images/ny.png',
      './images/px.png', './images/nz.png'
    ]);
    textureCube.encoding = THREE.sRGBEncoding;
    sceneEl.object3D.environment = textureCube;
  }
});

The environment attribute is successfully set, but the other objects materials still have envMap set to null and the environment lighting does not take effect on the materials.

Any ideas?

1 Answers1

2

aframe 1.0.4 uses three.js revision 111dev. The scene's environment property was introduced in revision 112 (source).

If you use the aframe master build - it seems to be working properly (as its based on three.js r119).

Otherwise, you'll have to iterate through the meshes, and set the material.envMap property manually.

Piotr Adam Milewski
  • 14,150
  • 3
  • 21
  • 42
  • Ah thanks for pointing that out - I'm currently doing what you suggested just thought the environment property would be a cleaner way to do it - guess I'll have to wait for the next stable build - Thanks Piotr – heroicsatsuma Oct 08 '20 at 15:15