Jelajahi Sumber

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

ncannasse 11 tahun lalu
induk
melakukan
345016435a
1 mengubah file dengan 4 tambahan dan 0 penghapusan
  1. 4 0
      h3d/shader/BaseMesh.hx

+ 4 - 0
h3d/shader/BaseMesh.hx

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