Browse Source

Add IndirectMultiplier term in Indirect shader. Setup to 1 by default.

borisrp 3 months ago
parent
commit
804b7d01ab
1 changed files with 6 additions and 1 deletions
  1. 6 1
      h3d/shader/pbr/Lighting.hx

+ 6 - 1
h3d/shader/pbr/Lighting.hx

@@ -31,6 +31,7 @@ class Indirect extends PropsDefinition {
 		@param var emissivePower : Float;
 
 		var calculatedUV : Vec2;
+		var indirectMultiplier : Float;
 
 		function rotateNormal( n : Vec3 ) : Vec3 {
 			return vec3(n.x * irrRotation.x - n.y * irrRotation.y, n.x * irrRotation.y + n.y * irrRotation.x, n.z);
@@ -44,6 +45,10 @@ class Indirect extends PropsDefinition {
 			return irrDiffuse.get( rotateNormal(normal) ).rgb;
 		}
 
+		function __init__fragment2() {
+			indirectMultiplier = 1.0;
+		}
+
 		function fragment() {
 			#if !MRT_low
 			var isSky = normal.dot(normal) <= 0;
@@ -87,7 +92,7 @@ class Indirect extends PropsDefinition {
 				}
 
 				var indirect = (diffuse * (1 - metalness) * (1 - F) + specular) * irrPower;
-				pixelColor.rgb += indirect * occlusion + albedo * emissive * emissivePower;
+				pixelColor.rgb += indirect * occlusion * indirectMultiplier + albedo * emissive * emissivePower;
 			}
 		}
 	};