# ShaderMaterial from MeshStandarMaterial how can i use the standard color

**URL:** <https://discourse.threejs.org/t/shadermaterial-from-meshstandarmaterial-how-can-i-use-the-standard-color/22951>\
**Category:** Questions\
**Created:** [January 29, 2021, 11:21am UTC](https://discourse.threejs.org/t/shadermaterial-from-meshstandarmaterial-how-can-i-use-the-standard-color/22951 "2021-01-29T11:21:04Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![arpu](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/arpu/32/6583_2.png) [@arpu](https://discourse.threejs.org/u/arpu)\
**Post date:** [January 29, 2021, 11:21am UTC](https://discourse.threejs.org/t/shadermaterial-from-meshstandarmaterial-how-can-i-use-the-standard-color/22951/1 "2021-01-29T11:21:04Z")

</div>

Hello i try to generate a MeshStandardMaterial with a ShaderMaterial

let standard = THREE.ShaderLib[‘standard’];  
const material = new THREE.ShaderMaterial({  
lights:true,  
fog:true,  
fragmentShader: standard.fragmentShader,  
vertexShader: standard.vertexShader,  
defaultAttributeValues: {‘color’: new THREE.Color(0x0054df ),‘uv’: [0, 0],  
‘uv2’: [0, 0]},  
uniforms:{ …UniformsUtils.clone(standard.uniforms)  
},  
color: new THREE.Color(0x0054df )  
});

but i add this to a PlaneBuffer Geometry and set the material needsUpdate true

anyway the color is still black

---

<div class="post-metadata">

**Author:** ![becky\_rose](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/becky_rose/32/15933_2.png) [@becky\_rose](https://discourse.threejs.org/u/becky_rose)\
**Post date:** [January 29, 2021, 11:26am UTC](https://discourse.threejs.org/t/shadermaterial-from-meshstandarmaterial-how-can-i-use-the-standard-color/22951/2 "2021-01-29T11:26:02Z")

</div>

Does your scene have any lighting? You’ll need at least an ambient to see anything.

---

<div class="post-metadata">

**Author:** ![arpu](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/arpu/32/6583_2.png) [@arpu](https://discourse.threejs.org/u/arpu)\
**Post date:** [January 29, 2021, 11:29am UTC](https://discourse.threejs.org/t/shadermaterial-from-meshstandarmaterial-how-can-i-use-the-standard-color/22951/3 "2021-01-29T11:29:13Z")

</div>

hmm thx will try! i use the scene.environment with THREE.PMREMGenerator

---

<div class="post-metadata">

**Author:** ![arpu](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/arpu/32/6583_2.png) [@arpu](https://discourse.threejs.org/u/arpu)\
**Post date:** [January 29, 2021, 11:34am UTC](https://discourse.threejs.org/t/shadermaterial-from-meshstandarmaterial-how-can-i-use-the-standard-color/22951/4 "2021-01-29T11:34:52Z")

</div>

found this example [https://jsfiddle.net/684vtyoz/](https://jsfiddle.net/684vtyoz/) from @Mugen87

---

<div class="post-metadata">

**Author:** ![arpu](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/arpu/32/6583_2.png) [@arpu](https://discourse.threejs.org/u/arpu)\
**Post date:** [January 29, 2021, 12:16pm UTC](https://discourse.threejs.org/t/shadermaterial-from-meshstandarmaterial-how-can-i-use-the-standard-color/22951/6 "2021-01-29T12:16:02Z")

</div>

ok found the problem on my side on generating the ShaderMateril scene.enviroment is null

is there a way to listen to a enviroment map change or set?

---

<div class="post-metadata">

**Author:** ![becky\_rose](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/becky_rose/32/15933_2.png) [@becky\_rose](https://discourse.threejs.org/u/becky_rose)\
**Post date:** [January 29, 2021, 12:28pm UTC](https://discourse.threejs.org/t/shadermaterial-from-meshstandarmaterial-how-can-i-use-the-standard-color/22951/7 "2021-01-29T12:28:47Z")

</div>

Just set the scene.environment or material.envMap to the loader.

eg.  
scene.environment = new THREE.CubeTextureLoader().setPath( etc…

---

<div class="post-metadata">

**Author:** ![becky\_rose](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/becky_rose/32/15933_2.png) [@becky\_rose](https://discourse.threejs.org/u/becky_rose)\
**Post date:** [January 29, 2021, 12:29pm UTC](https://discourse.threejs.org/t/shadermaterial-from-meshstandarmaterial-how-can-i-use-the-standard-color/22951/8 "2021-01-29T12:29:33Z")

</div>

actually I usually create a reference I can use in multiple places…

environmentMap = new THREE.CubeTextureLoader();  
scene.environment = environmentMap;  
material.envMap = environmentMap;

etc.

---

<div class="post-metadata">

**Author:** ![arpu](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/arpu/32/6583_2.png) [@arpu](https://discourse.threejs.org/u/arpu)\
**Post date:** [January 29, 2021, 12:31pm UTC](https://discourse.threejs.org/t/shadermaterial-from-meshstandarmaterial-how-can-i-use-the-standard-color/22951/9 "2021-01-29T12:31:09Z")

</div>

thx @becky_rose this bring me in the right direction!
