# Setting MeshStandardMaterials.lights to false yields errors

**URL:** https://discourse.threejs.org/t/setting-meshstandardmaterials-lights-to-false-yields-errors/8106
**Category:** Questions
**Tags:** materials
**Created:** [June 14, 2019, 11:51am UTC](https://discourse.threejs.org/t/setting-meshstandardmaterials-lights-to-false-yields-errors/8106 "2019-06-14T11:51:57Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![michaelvbe](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/michaelvbe/32/6000_2.png) [@michaelvbe](https://discourse.threejs.org/u/michaelvbe)
#### Post date: [June 14, 2019, 11:51am UTC](https://discourse.threejs.org/t/setting-meshstandardmaterials-lights-to-false-yields-errors/8106/1 "2019-06-14T11:51:57Z")

</div>

I’m trying to conditionally let lights affect materials (presence of lightMap), but setting `lights = false` on `MeshStandardMaterial` yields errors and the mesh disappears from the scene.

The following error is thrown at ~3 errors per second:

```auto
three.module.js:11061 Uncaught TypeError: Cannot read property 'toArray' of undefined
    at flatten (three.module.js:11061)
    at PureArrayUniform.setValueV3fArray [as setValue] (three.module.js:11400)
    at Function.push../node_modules/three/build/three.module.js.WebGLUniforms.upload (three.module.js:11628)
    at setProgram (three.module.js:16866)
    at WebGLRenderer.renderBufferDirect (three.module.js:16068)
    at renderObject (three.module.js:16535)
    at renderObjects (three.module.js:16516)
    at WebGLRenderer.render (three.module.js:16393)
    at Viewer.render (Viewer.js:80)
    at Viewer.js:70

```

I’m not sure if this is a Three.JS bug or a bug in my code but i wouldn’t know where to go from here.

Greetings,  
Michael

---

<div class="post-metadata">

### Author: ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)
#### Post date: [June 14, 2019, 12:30pm UTC](https://discourse.threejs.org/t/setting-meshstandardmaterials-lights-to-false-yields-errors/8106/2 "2019-06-14T12:30:20Z")

</div>

The `light` property can only be changed for `ShaderMaterial` and `RawShaderMaterial`. For all other materials it is considered to be read-only.

I’ve tried to clarify the docs once but unfortunately the PR was not merged:

> <https://github.com/mrdoob/three.js/pull/15318>

---

<div class="post-metadata">

### Author: ![michaelvbe](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/michaelvbe/32/6000_2.png) [@michaelvbe](https://discourse.threejs.org/u/michaelvbe)
#### Post date: [June 14, 2019, 12:51pm UTC](https://discourse.threejs.org/t/setting-meshstandardmaterials-lights-to-false-yields-errors/8106/3 "2019-06-14T12:51:19Z")

</div>

Ah, that’s a shame.

Would you know of a way to get lightMaps working in `MeshStandardMaterial`?

Currently it doesn’t really work when there is light (`AmbientLight`) as light maps are additive if i understand correctly.

I don’t really have a good background in 3d modelling and materials sadly.

---

<div class="post-metadata">

### Author: ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)
#### Post date: [June 14, 2019, 2:56pm UTC](https://discourse.threejs.org/t/setting-meshstandardmaterials-lights-to-false-yields-errors/8106/4 "2019-06-14T14:56:28Z")

</div>

If you want to use an unlit material with a light map, use [MeshBasicMaterial](https://threejs.org/docs/index.html#api/en/materials/MeshBasicMaterial) instead.
