瀏覽代碼

Fix PBR Bump Scale

Sebastien Vandenberghe 8 年之前
父節點
當前提交
5c012aaa47
共有 2 個文件被更改,包括 5 次插入2 次删除
  1. 0 1
      src/Shaders/ShadersInclude/bumpFragment.fx
  2. 5 1
      src/Shaders/ShadersInclude/bumpFragmentFunctions.fx

+ 0 - 1
src/Shaders/ShadersInclude/bumpFragment.fx

@@ -2,7 +2,6 @@
 
 #if defined(BUMP) || defined(PARALLAX)
 	#ifdef NORMALXYSCALE
-		normalW = normalize(normalW * vec3(vBumpInfos.y, vBumpInfos.y, 1.0));
 		float normalScale = 1.0;
 	#else		
 		float normalScale = vBumpInfos.y;

+ 5 - 1
src/Shaders/ShadersInclude/bumpFragmentFunctions.fx

@@ -41,11 +41,15 @@
 	vec3 perturbNormal(mat3 cotangentFrame, vec2 uv)
 	{
 		vec3 map = texture2D(bumpSampler, uv).xyz;
-
 		map.x = vNormalReoderParams.x + vNormalReoderParams.y * map.x;
 		map.y = vNormalReoderParams.z + vNormalReoderParams.w * map.y;
 
 		map = map * 255. / 127. - 128. / 127.;
+
+		#ifdef NORMALXYSCALE
+			map = normalize(map * vec3(vBumpInfos.y, vBumpInfos.y, 1.0));
+		#endif
+
 		return normalize(cotangentFrame * map);
 	}