Shadows on ShaderMaterial Extended from Phong

shaders

#1

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?


#2

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?