Преглед на файлове

Fix generation of env map, closes #18880

Juan Linietsky преди 7 години
родител
ревизия
62233423c7
променени са 2 файла, в които са добавени 8 реда и са изтрити 8 реда
  1. 3 3
      drivers/gles2/shaders/cubemap_filter.glsl
  2. 5 5
      drivers/gles3/shaders/cubemap_filter.glsl

+ 3 - 3
drivers/gles2/shaders/cubemap_filter.glsl

@@ -170,10 +170,10 @@ void main() {
 		if (NdotL > 0.0) {
 
 #ifdef USE_SOURCE_PANORAMA
-			sum.rgb += texturePanorama(source_panorama, H).rgb * NdotL;
+			sum.rgb += texturePanorama(source_panorama, L).rgb * NdotL;
 #else
-			H.y = -H.y;
-			sum.rgb += textureCubeLod(source_cube, H, 0.0).rgb * NdotL;
+			L.y = -L.y;
+			sum.rgb += textureCubeLod(source_cube, L, 0.0).rgb * NdotL;
 #endif
 
 			sum.a += NdotL;

+ 5 - 5
drivers/gles3/shaders/cubemap_filter.glsl

@@ -244,23 +244,23 @@ void main() {
 
 		vec3 H = ImportanceSampleGGX(xi, roughness, N);
 		vec3 V = N;
-		vec3 L = normalize(2.0 * dot(V, H) * H - V);
+		vec3 L = (2.0 * dot(V, H) * H - V);
 
 		float ndotl = clamp(dot(N, L), 0.0, 1.0);
 
 		if (ndotl > 0.0) {
 #ifdef USE_SOURCE_PANORAMA
-			sum.rgb += texturePanorama(H, source_panorama).rgb * ndotl;
+			sum.rgb += texturePanorama(L, source_panorama).rgb * ndotl;
 #endif
 
 #ifdef USE_SOURCE_DUAL_PARABOLOID_ARRAY
 
-			sum.rgb += textureDualParaboloidArray(H).rgb * ndotl;
+			sum.rgb += textureDualParaboloidArray(L).rgb * ndotl;
 #endif
 
 #if !defined(USE_SOURCE_DUAL_PARABOLOID_ARRAY) && !defined(USE_SOURCE_PANORAMA)
-			H.y = -H.y;
-			sum.rgb += textureLod(source_cube, H, 0.0).rgb * ndotl;
+			L.y = -L.y;
+			sum.rgb += textureLod(source_cube, L, 0.0).rgb * ndotl;
 #endif
 			sum.a += ndotl;
 		}