# Shadows on ShaderMaterial Extended from Phong

**URL:** https://discourse.threejs.org/t/shadows-on-shadermaterial-extended-from-phong/2825
**Category:** Questions
**Tags:** shaders
**Created:** [May 14, 2018, 1:21am UTC](https://discourse.threejs.org/t/shadows-on-shadermaterial-extended-from-phong/2825 "2018-05-14T01:21:05Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![titansoftime](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/titansoftime/32/1044_2.png) [@titansoftime](https://discourse.threejs.org/u/titansoftime)
#### Post date: [May 14, 2018, 1:21am UTC](https://discourse.threejs.org/t/shadows-on-shadermaterial-extended-from-phong/2825/1 "2018-05-14T01:21:06Z")

</div>

I got shadows working on an extended Lambert shader no problem.

I extended the phong shader and it is not working for me.

I’m assuming because the THREE.ShaderLib[‘lambert’] has the following:

`reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();`

The Phong fragment shader has no such code in it.

Do i need to patch in the shadow shader code from lambert? That doesn’t really make sense. Why would Lambert shader work with shadows “out of the box” and not phong?

What am I missing here?

---

<div class="post-metadata">

### Author: ![titansoftime](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/titansoftime/32/1044_2.png) [@titansoftime](https://discourse.threejs.org/u/titansoftime)
#### Post date: [May 16, 2018, 1:36am UTC](https://discourse.threejs.org/t/shadows-on-shadermaterial-extended-from-phong/2825/2 "2018-05-16T01:36:59Z")

</div>

Ok,

Turns out the objects were receiving shadows just fine…

What I actually was after was getting these instances to **cast** shadows.

I’ve tinkered around a bit and have had no luck.

Is there anything special I need to do to cast shadows with an extended phong shader?
