@@ -994,10 +994,11 @@ void main() {
9949943-shadow
9959954-lightmap textures
9969965-shadowmask textures
997- 6-screen
998- 7-depth
999- 8-reflection probe 1
1000- 9-reflection probe 2
997+ 6-directional textures
998+ 7-screen
999+ 8-depth
1000+ 9-reflection probe 1
1001+ 10-reflection probe 2
10011002
10021003*/
10031004
@@ -1085,7 +1086,7 @@ uniform float refprobe1_blend_distance;
10851086uniform int refprobe1_ambient_mode;
10861087uniform vec4 refprobe1_ambient_color;
10871088
1088- uniform samplerCube refprobe1_texture; // texunit:-8
1089+ uniform samplerCube refprobe1_texture; // texunit:-9
10891090
10901091#ifdef SECOND_REFLECTION_PROBE
10911092
@@ -1099,7 +1100,7 @@ uniform float refprobe2_blend_distance;
10991100uniform int refprobe2_ambient_mode;
11001101uniform vec4 refprobe2_ambient_color;
11011102
1102- uniform samplerCube refprobe2_texture; // texunit:-9
1103+ uniform samplerCube refprobe2_texture; // texunit:-10
11031104
11041105#endif // SECOND_REFLECTION_PROBE
11051106
@@ -1379,6 +1380,7 @@ float sample_shadow(highp sampler2DShadow shadow, float shadow_pixel_size, vec4
13791380#ifdef USE_LIGHTMAP
13801381uniform mediump sampler2DArray lightmap_textures; // texunit:-4
13811382uniform lowp sampler2DArray shadowmask_textures; // texunit:-5
1383+ uniform mediump sampler2DArray directional_textures; // texunit:-6
13821384uniform lowp uint lightmap_slice;
13831385uniform highp vec4 lightmap_uv_scale;
13841386uniform float lightmap_exposure_normalization;
@@ -1404,17 +1406,17 @@ uniform mediump vec4[9] lightmap_captures;
14041406#endif // !DISABLE_LIGHTMAP
14051407
14061408#ifdef USE_MULTIVIEW
1407- uniform highp sampler2DArray depth_buffer; // texunit:-7
1408- uniform highp sampler2DArray color_buffer; // texunit:-6
1409+ uniform highp sampler2DArray depth_buffer; // texunit:-8
1410+ uniform highp sampler2DArray color_buffer; // texunit:-7
14091411vec3 multiview_uv(vec2 uv) {
14101412 return vec3 (uv, ViewIndex);
14111413}
14121414ivec3 multiview_uv(ivec2 uv) {
14131415 return ivec3 (uv, int (ViewIndex));
14141416}
14151417#else
1416- uniform highp sampler2D depth_buffer; // texunit:-7
1417- uniform highp sampler2D color_buffer; // texunit:-6
1418+ uniform highp sampler2D depth_buffer; // texunit:-8
1419+ uniform highp sampler2D color_buffer; // texunit:-7
14181420vec2 multiview_uv(vec2 uv) {
14191421 return uv;
14201422}
@@ -2296,23 +2298,19 @@ void main() {
22962298#else
22972299#ifdef USE_LIGHTMAP
22982300 {
2299- vec3 uvw;
2300- uvw.xy = uv2 * lightmap_uv_scale.zw + lightmap_uv_scale.xy;
2301- uvw.z = float (lightmap_slice);
2301+ vec3 uvw = vec3 (uv2 * lightmap_uv_scale.zw + lightmap_uv_scale.xy, float (lightmap_slice));
23022302
23032303#ifdef USE_SH_LIGHTMAP
2304- uvw.z *= 4.0 ; // SH textures use 4 times more data.
2305-
23062304#ifdef LIGHTMAP_BICUBIC_FILTER
2307- vec3 lm_light_l0 = textureArray_bicubic(lightmap_textures, uvw + vec3 ( 0.0 , 0.0 , 0.0 ) , lightmap_texture_size).rgb;
2308- 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 ;
2309- 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 ;
2310- 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 ;
2305+ vec3 lm_light_l0 = textureArray_bicubic(lightmap_textures, uvw, lightmap_texture_size).rgb;
2306+ 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 ;
2307+ 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 ;
2308+ 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 ;
23112309#else
2312- vec3 lm_light_l0 = textureLod(lightmap_textures, uvw + vec3 ( 0.0 , 0.0 , 0.0 ) , 0.0 ).rgb;
2313- vec3 lm_light_l1n1 = (textureLod(lightmap_textures, uvw + vec3 (0.0 , 0.0 , 1 .0 ), 0.0 ).rgb - vec3 (0.5 )) * 2.0 ;
2314- vec3 lm_light_l1_0 = (textureLod(lightmap_textures, uvw + vec3 (0.0 , 0.0 , 2 .0 ), 0.0 ).rgb - vec3 (0.5 )) * 2.0 ;
2315- vec3 lm_light_l1p1 = (textureLod(lightmap_textures, uvw + vec3 (0.0 , 0.0 , 3 .0 ), 0.0 ).rgb - vec3 (0.5 )) * 2.0 ;
2310+ vec3 lm_light_l0 = textureLod(lightmap_textures, uvw, 0.0 ).rgb;
2311+ vec3 lm_light_l1n1 = (textureLod(directional_textures, vec3 (uvw.xy, uvw.z * 3 + 0 .0 ), 0.0 ).rgb - vec3 (0.5 )) * 2.0 ;
2312+ vec3 lm_light_l1_0 = (textureLod(directional_textures, vec3 (uvw.xy, uvw.z * 3 + 1 .0 ), 0.0 ).rgb - vec3 (0.5 )) * 2.0 ;
2313+ vec3 lm_light_l1p1 = (textureLod(directional_textures, vec3 (uvw.xy, uvw.z * 3 + 2 .0 ), 0.0 ).rgb - vec3 (0.5 )) * 2.0 ;
23162314#endif
23172315
23182316 vec3 n = normalize (lightmap_normal_xform * normal);
0 commit comments