Bladeren bron

store roughness intermediate

ncannasse 7 jaren geleden
bovenliggende
commit
8aa5c8fdaf
3 gewijzigde bestanden met toevoegingen van 35 en 2 verwijderingen
  1. 1 1
      h3d/scene/pbr/Renderer.hx
  2. 1 1
      h3d/shader/pbr/PropsImport.hx
  3. 33 0
      h3d/shader/pbr/PropsValues.hx

+ 1 - 1
h3d/scene/pbr/Renderer.hx

@@ -23,7 +23,7 @@ class Renderer extends h3d.scene.Renderer {
 	var output = new h3d.pass.Output("mrt",[
 		Value("output.color"),
 		Vec4([Value("output.normal",3),Value("output.depth",1)]),
-		Vec4([Value("output.metalness"), Value("output.gloss"), Value("output.occlusion"), Const(0)]),
+		Vec4([Value("output.metalness"), Value("output.roughness"), Value("output.occlusion"), Const(0)]),
 	]);
 
 	public function new(irrad) {

+ 1 - 1
h3d/shader/pbr/PropsImport.hx

@@ -29,7 +29,7 @@ class PropsImport extends hxsl.Shader {
 			depth = normalDepth.w;
 			var pbr = pbrTex.get(uv);
 			metalness = pbr.r;
-			roughness = 1 - pbr.g;
+			roughness = pbr.g;
 			occlusion = pbr.b;
 
 			specularColor = metalness < 0.3 ? vec3(metalness) : albedo;

+ 33 - 0
h3d/shader/pbr/PropsValues.hx

@@ -0,0 +1,33 @@
+package h3d.shader.pbr;
+
+class PropsValues extends hxsl.Shader {
+
+	static var SRC = {
+
+		var output : {
+			metalness : Float,
+			roughness : Float,
+			occlusion : Float,
+		};
+
+		@param var metalness : Float;
+		@param var roughness : Float;
+		@param var occlusion : Float;
+
+		function fragment() {
+			output.metalness = metalness;
+			output.roughness = roughness;
+			output.occlusion = occlusion;
+		}
+
+	};
+
+	public function new(metalness=0.,roughness=1.,occlusion=0.) {
+		super();
+		this.metalness = metalness;
+		this.roughness = roughness;
+		this.occlusion = occlusion;
+	}
+
+}
+