@@ -836,10 +836,11 @@ void main() {
8368363-shadow
8378374-lightmap textures
8388385-shadowmask textures
839- 6-screen
840- 7-depth
841- 8-reflection probe 1
842- 9-reflection probe 2
839+ 6-directional textures
840+ 7-screen
841+ 8-depth
842+ 9-reflection probe 1
843+ 10-reflection probe 2
843844
844845*/
845846
@@ -921,7 +922,7 @@ uniform float refprobe1_blend_distance;
921922uniform int refprobe1_ambient_mode;
922923uniform vec4 refprobe1_ambient_color;
923924
924- uniform samplerCube refprobe1_texture; // texunit:-8
925+ uniform samplerCube refprobe1_texture; // texunit:-9
925926
926927#ifdef SECOND_REFLECTION_PROBE
927928
@@ -935,7 +936,7 @@ uniform float refprobe2_blend_distance;
935936uniform int refprobe2_ambient_mode;
936937uniform vec4 refprobe2_ambient_color;
937938
938- uniform samplerCube refprobe2_texture; // texunit:-9
939+ uniform samplerCube refprobe2_texture; // texunit:-10
939940
940941#endif // SECOND_REFLECTION_PROBE
941942
@@ -1210,6 +1211,7 @@ float sample_shadow(highp sampler2DShadow shadow, float shadow_pixel_size, vec4
12101211#ifdef USE_LIGHTMAP
12111212uniform mediump sampler2DArray lightmap_textures; // texunit:-4
12121213uniform lowp sampler2DArray shadowmask_textures; // texunit:-5
1214+ uniform mediump sampler2DArray directional_textures; // texunit:-6
12131215uniform lowp uint lightmap_slice;
12141216uniform highp vec4 lightmap_uv_scale;
12151217uniform float lightmap_exposure_normalization;
@@ -1235,17 +1237,17 @@ uniform mediump vec4[9] lightmap_captures;
12351237#endif // !DISABLE_LIGHTMAP
12361238
12371239#ifdef USE_MULTIVIEW
1238- uniform highp sampler2DArray depth_buffer; // texunit:-7
1239- uniform highp sampler2DArray color_buffer; // texunit:-6
1240+ uniform highp sampler2DArray depth_buffer; // texunit:-8
1241+ uniform highp sampler2DArray color_buffer; // texunit:-7
12401242vec3 multiview_uv(vec2 uv) {
12411243 return vec3 (uv, ViewIndex);
12421244}
12431245ivec3 multiview_uv(ivec2 uv) {
12441246 return ivec3 (uv, int (ViewIndex));
12451247}
12461248#else
1247- uniform highp sampler2D depth_buffer; // texunit:-7
1248- uniform highp sampler2D color_buffer; // texunit:-6
1249+ uniform highp sampler2D depth_buffer; // texunit:-8
1250+ uniform highp sampler2D color_buffer; // texunit:-7
12491251vec2 multiview_uv(vec2 uv) {
12501252 return uv;
12511253}
@@ -2109,23 +2111,19 @@ void main() {
21092111#else
21102112#ifdef USE_LIGHTMAP
21112113 {
2112- vec3 uvw;
2113- uvw.xy = uv2 * lightmap_uv_scale.zw + lightmap_uv_scale.xy;
2114- uvw.z = float (lightmap_slice);
2114+ vec3 uvw = vec3 (uv2 * lightmap_uv_scale.zw + lightmap_uv_scale.xy, float (lightmap_slice));
21152115
21162116#ifdef USE_SH_LIGHTMAP
2117- uvw.z *= 4.0 ; // SH textures use 4 times more data.
2118-
21192117#ifdef LIGHTMAP_BICUBIC_FILTER
2120- vec3 lm_light_l0 = textureArray_bicubic(lightmap_textures, uvw + vec3 ( 0.0 , 0.0 , 0.0 ) , lightmap_texture_size).rgb;
2121- vec3 lm_light_l1n1 = (textureArray_bicubic(lightmap_textures, uvw + vec3 (0.0 , 0.0 , 1 .0 ), lightmap_texture_size).rgb - vec3 (0.5 )) * 2.0 ;
2122- vec3 lm_light_l1_0 = (textureArray_bicubic(lightmap_textures, uvw + vec3 (0.0 , 0.0 , 2 .0 ), lightmap_texture_size).rgb - vec3 (0.5 )) * 2.0 ;
2123- vec3 lm_light_l1p1 = (textureArray_bicubic(lightmap_textures, uvw + vec3 (0.0 , 0.0 , 3 .0 ), lightmap_texture_size).rgb - vec3 (0.5 )) * 2.0 ;
2118+ vec3 lm_light_l0 = textureArray_bicubic(lightmap_textures, uvw, lightmap_texture_size).rgb;
2119+ vec3 lm_light_l1n1 = (textureArray_bicubic(directional_textures, vec3 (uvw.xy, uvw.z * 3 + 0 .0 ), lightmap_texture_size).rgb - vec3 (0.5 )) * 2.0 ;
2120+ vec3 lm_light_l1_0 = (textureArray_bicubic(directional_textures, vec3 (uvw.xy, uvw.z * 3 + 1 .0 ), lightmap_texture_size).rgb - vec3 (0.5 )) * 2.0 ;
2121+ vec3 lm_light_l1p1 = (textureArray_bicubic(directional_textures, vec3 (uvw.xy, uvw.z * 3 + 2 .0 ), lightmap_texture_size).rgb - vec3 (0.5 )) * 2.0 ;
21242122#else
2125- vec3 lm_light_l0 = textureLod(lightmap_textures, uvw + vec3 ( 0.0 , 0.0 , 0.0 ) , 0.0 ).rgb;
2126- vec3 lm_light_l1n1 = (textureLod(lightmap_textures, uvw + vec3 (0.0 , 0.0 , 1 .0 ), 0.0 ).rgb - vec3 (0.5 )) * 2.0 ;
2127- vec3 lm_light_l1_0 = (textureLod(lightmap_textures, uvw + vec3 (0.0 , 0.0 , 2 .0 ), 0.0 ).rgb - vec3 (0.5 )) * 2.0 ;
2128- vec3 lm_light_l1p1 = (textureLod(lightmap_textures, uvw + vec3 (0.0 , 0.0 , 3 .0 ), 0.0 ).rgb - vec3 (0.5 )) * 2.0 ;
2123+ vec3 lm_light_l0 = textureLod(lightmap_textures, uvw, 0.0 ).rgb;
2124+ vec3 lm_light_l1n1 = (textureLod(directional_textures, vec3 (uvw.xy, uvw.z * 3 + 0 .0 ), 0.0 ).rgb - vec3 (0.5 )) * 2.0 ;
2125+ vec3 lm_light_l1_0 = (textureLod(directional_textures, vec3 (uvw.xy, uvw.z * 3 + 1 .0 ), 0.0 ).rgb - vec3 (0.5 )) * 2.0 ;
2126+ vec3 lm_light_l1p1 = (textureLod(directional_textures, vec3 (uvw.xy, uvw.z * 3 + 2 .0 ), 0.0 ).rgb - vec3 (0.5 )) * 2.0 ;
21292127#endif
21302128
21312129 vec3 n = normalize (lightmap_normal_xform * normal);
0 commit comments