Explorar o código

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

ncannasse %!s(int64=11) %!d(string=hai) anos
pai
achega
345016435a
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  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;