Created
December 17, 2017 19:10
-
-
Save haroldiedema/b8f94c53f2a28b6278860622dad4ad8e to your computer and use it in GitHub Desktop.
Lit both sides equally for double-sided lambert material instances.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
THREE.ShaderLib[ 'lambert' ].fragmentShader = THREE.ShaderLib[ 'lambert' ].fragmentShader.replace( | |
`vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;`, | |
` | |
#ifdef DOUBLE_SIDED | |
reflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor ); | |
reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ); | |
reflectedLight.directDiffuse = diffuseColor.rgb; | |
reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask(); | |
vec3 outgoingLight = (reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance).rgb * ( 1.0 - 0.45 * ( 1.0 - getShadowMask() ) ); | |
#else | |
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; | |
#endif | |
` | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment