浏览代码

make sure the normal is always renormalized in fragment shader after its interpolation

ncannasse 11 年之前
父节点
当前提交
345016435a
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      h3d/shader/BaseMesh.hx

+ 4 - 0
h3d/shader/BaseMesh.hx

@@ -50,6 +50,10 @@ class BaseMesh extends hxsl.Shader {
 			pixelColor = color;
 			pixelColor = color;
 			depth = projectedPosition.z / projectedPosition.w;
 			depth = projectedPosition.z / projectedPosition.w;
 		}
 		}
+		
+		function __init__fragment() {
+			transformedNormal = transformedNormal.normalize();
+		}
 
 
 		function vertex() {
 		function vertex() {
 			output.position = projectedPosition;
 			output.position = projectedPosition;