@@ -170,17 +170,12 @@ vec3 getDiffuse(
170
170
return col;
171
171
}
172
172
173
+ // COMPAT: pre-r156 uses a struct GeometricContext
173
174
#if THREE_VRM_THREE_REVISION >= 157
174
175
void RE_Direct_MToon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in MToonMaterial material, const in float shadow, inout ReflectedLight reflectedLight ) {
175
176
float dotNL = clamp ( dot ( geometryNormal, directLight.direction ), - 1.0 , 1.0 );
176
177
vec3 irradiance = directLight.color;
177
178
178
- #if THREE_VRM_THREE_REVISION < 132
179
- #ifndef PHYSICALLY_CORRECT_LIGHTS
180
- irradiance *= PI;
181
- #endif
182
- #endif
183
-
184
179
// directSpecular will be used for rim lighting, not an actual specular
185
180
reflectedLight.directSpecular += irradiance;
186
181
@@ -611,11 +606,12 @@ void main() {
611
606
// Since we want to take shadows into account of shading instead of irradiance,
612
607
// we had to modify the codes that multiplies the results of shadowmap into color of direct lights.
613
608
609
+ // COMPAT: pre-r156 uses a struct GeometricContext
614
610
#if THREE_VRM_THREE_REVISION >= 157
615
611
vec3 geometryPosition = - vViewPosition;
616
612
vec3 geometryNormal = normal;
617
613
vec3 geometryViewDir = ( isOrthographic ) ? vec3 ( 0 , 0 , 1 ) : normalize ( vViewPosition );
618
-
614
+
619
615
vec3 geometryClearcoatNormal;
620
616
621
617
#ifdef USE_CLEARCOAT
@@ -654,6 +650,7 @@ void main() {
654
650
655
651
pointLight = pointLights[ i ];
656
652
653
+ // COMPAT: pre-r156 uses a struct GeometricContext
657
654
#if THREE_VRM_THREE_REVISION >= 157
658
655
getPointLightInfo( pointLight, geometryPosition, directLight );
659
656
#elif THREE_VRM_THREE_REVISION >= 132
@@ -668,6 +665,7 @@ void main() {
668
665
shadow = all ( bvec2 ( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0 ;
669
666
#endif
670
667
668
+ // COMPAT: pre-r156 uses a struct GeometricContext
671
669
#if THREE_VRM_THREE_REVISION >= 157
672
670
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, shadow, reflectedLight );
673
671
#else
@@ -691,6 +689,7 @@ void main() {
691
689
692
690
spotLight = spotLights[ i ];
693
691
692
+ // COMPAT: pre-r156 uses a struct GeometricContext
694
693
#if THREE_VRM_THREE_REVISION >= 157
695
694
getSpotLightInfo( spotLight, geometryPosition, directLight );
696
695
#elif THREE_VRM_THREE_REVISION >= 132
@@ -705,6 +704,7 @@ void main() {
705
704
shadow = all ( bvec2 ( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0 ;
706
705
#endif
707
706
707
+ // COMPAT: pre-r156 uses a struct GeometricContext
708
708
#if THREE_VRM_THREE_REVISION >= 157
709
709
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, shadow, reflectedLight );
710
710
#else
@@ -728,6 +728,7 @@ void main() {
728
728
729
729
directionalLight = directionalLights[ i ];
730
730
731
+ // COMPAT: pre-r156 uses a struct GeometricContext
731
732
#if THREE_VRM_THREE_REVISION >= 157
732
733
getDirectionalLightInfo( directionalLight, directLight );
733
734
#elif THREE_VRM_THREE_REVISION >= 132
@@ -742,6 +743,7 @@ void main() {
742
743
shadow = all ( bvec2 ( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0 ;
743
744
#endif
744
745
746
+ // COMPAT: pre-r156 uses a struct GeometricContext
745
747
#if THREE_VRM_THREE_REVISION >= 157
746
748
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, shadow, reflectedLight );
747
749
#else
@@ -774,6 +776,8 @@ void main() {
774
776
775
777
vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
776
778
779
+ // COMPAT: pre-r156 uses a struct GeometricContext
780
+ // COMPAT: pre-r156 doesn't have a define USE_LIGHT_PROBES
777
781
#if THREE_VRM_THREE_REVISION >= 157
778
782
#if defined( USE_LIGHT_PROBES )
779
783
irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
@@ -789,6 +793,7 @@ void main() {
789
793
#pragma unroll_loop_start
790
794
for ( int i = 0 ; i < NUM_HEMI_LIGHTS; i ++ ) {
791
795
796
+ // COMPAT: pre-r156 uses a struct GeometricContext
792
797
#if THREE_VRM_THREE_REVISION >= 157
793
798
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
794
799
#elif THREE_VRM_THREE_REVISION >= 133
0 commit comments