File tree Expand file tree Collapse file tree 3 files changed +19
-8
lines changed Expand file tree Collapse file tree 3 files changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -12,9 +12,11 @@ backGeometry.normal = -geometry.normal;
1212backGeometry.viewDir = geometry.viewDir;
1313
1414vLightFront = vec3( 0.0 );
15+ vIndirectFront = vec3( 0.0 );
1516
1617#ifdef DOUBLE_SIDED
1718 vLightBack = vec3( 0.0 );
19+ vIndirectBack = vec3( 0.0 );
1820#endif
1921
2022IncidentLight directLight;
@@ -103,11 +105,11 @@ vec3 directLightColor_Diffuse;
103105 #pragma unroll_loop
104106 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
105107
106- vLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
108+ vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
107109
108110 #ifdef DOUBLE_SIDED
109111
110- vLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );
112+ vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );
111113
112114 #endif
113115
Original file line number Diff line number Diff line change @@ -4,13 +4,14 @@ uniform vec3 emissive;
44uniform float opacity;
55
66varying vec3 vLightFront;
7+ varying vec3 vIndirectFront;
78
89#ifdef DOUBLE_SIDED
9-
1010 varying vec3 vLightBack;
11-
11+ varying vec3 vIndirectBack;
1212#endif
1313
14+
1415#include <common>
1516#include <packing>
1617#include <dithering_pars_fragment>
@@ -51,6 +52,16 @@ void main() {
5152 // accumulation
5253 reflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );
5354
55+ #ifdef DOUBLE_SIDED
56+
57+ reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;
58+
59+ #else
60+
61+ reflectedLight.indirectDiffuse += vIndirectFront;
62+
63+ #endif
64+
5465 #include <lightmap_fragment>
5566
5667 reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );
@@ -81,6 +92,5 @@ void main() {
8192 #include <fog_fragment>
8293 #include <premultiplied_alpha_fragment>
8394 #include <dithering_fragment>
84-
8595}
8696` ;
Original file line number Diff line number Diff line change @@ -2,11 +2,11 @@ export default /* glsl */`
22#define LAMBERT
33
44varying vec3 vLightFront;
5+ varying vec3 vIndirectFront;
56
67#ifdef DOUBLE_SIDED
7-
88 varying vec3 vLightBack;
9-
9+ varying vec3 vIndirectBack;
1010#endif
1111
1212#include <common>
@@ -47,6 +47,5 @@ void main() {
4747 #include <lights_lambert_vertex>
4848 #include <shadowmap_vertex>
4949 #include <fog_vertex>
50-
5150}
5251` ;
You can’t perform that action at this time.
0 commit comments