diff --git a/jme3-core/src/main/java/com/jme3/environment/util/EnvMapUtils.java b/jme3-core/src/main/java/com/jme3/environment/util/EnvMapUtils.java index d48ff690e..09f582723 100644 --- a/jme3-core/src/main/java/com/jme3/environment/util/EnvMapUtils.java +++ b/jme3-core/src/main/java/com/jme3/environment/util/EnvMapUtils.java @@ -433,7 +433,7 @@ public class EnvMapUtils { public static float getRoughnessFromMip(int miplevel, int miptot) { float mipScale = 1.0f; - float mipOffset = -0.5f; + float mipOffset = -0.3f; return pow(2, (miplevel - (miptot - 1) + mipOffset) / mipScale); } diff --git a/jme3-core/src/main/resources/Common/ShaderLib/PBR.glsllib b/jme3-core/src/main/resources/Common/ShaderLib/PBR.glsllib index 4de60091a..bad4f630a 100644 --- a/jme3-core/src/main/resources/Common/ShaderLib/PBR.glsllib +++ b/jme3-core/src/main/resources/Common/ShaderLib/PBR.glsllib @@ -143,7 +143,7 @@ vec3 ApproximateSpecularIBL(samplerCube envMap,sampler2D integrateBRDF, vec3 Spe vec3 ApproximateSpecularIBLPolynomial(samplerCube envMap, vec3 SpecularColor , float Roughness, float ndotv, vec3 refVec){ //TODO magic values should be replaced by defines. - float Lod = log2(Roughness) * 1.1 + 6.0 - 2.0; + float Lod = log2(Roughness) * 1.5 + 6.0 - 1.0; vec3 PrefilteredColor = textureCubeLod(envMap, refVec.xyz, Lod).rgb; return PrefilteredColor * EnvDFGPolynomial(SpecularColor, Roughness, ndotv); } diff --git a/jme3-examples/src/main/java/jme3test/light/pbr/TestPBRLighting.java b/jme3-examples/src/main/java/jme3test/light/pbr/TestPBRLighting.java index fe8a26851..150b49329 100644 --- a/jme3-examples/src/main/java/jme3test/light/pbr/TestPBRLighting.java +++ b/jme3-examples/src/main/java/jme3test/light/pbr/TestPBRLighting.java @@ -57,6 +57,7 @@ import com.jme3.scene.Spatial; import com.jme3.texture.plugins.ktx.KTXLoader; import com.jme3.util.MaterialDebugAppState; import com.jme3.util.SkyFactory; +import com.jme3.util.mikktspace.MikktspaceTangentGenerator; /** * A test case for PBR lighting. @@ -83,6 +84,7 @@ public class TestPBRLighting extends SimpleApplication { viewPort.setBackgroundColor(ColorRGBA.White); modelNode = (Node) new Node("modelNode"); model = (Geometry) assetManager.loadModel("Models/Tank/tank.j3o"); + //MikktspaceTangentGenerator.generate(model); modelNode.attachChild(model); dl = new DirectionalLight(); @@ -93,9 +95,9 @@ public class TestPBRLighting extends SimpleApplication { FilterPostProcessor fpp = new FilterPostProcessor(assetManager); - fpp.addFilter(new FXAAFilter()); +// fpp.addFilter(new FXAAFilter()); fpp.addFilter(new ToneMapFilter(Vector3f.UNIT_XYZ.mult(4.0f))); - fpp.addFilter(new SSAOFilter(0.5f, 3, 0.2f, 0.2f)); +// fpp.addFilter(new SSAOFilter(0.5f, 3, 0.2f, 0.2f)); viewPort.addProcessor(fpp); //Spatial sky = SkyFactory.createSky(assetManager, "Textures/Sky/Sky_Cloudy.hdr", SkyFactory.EnvMapType.EquirectMap); diff --git a/jme3-testdata/src/main/resources/Models/Tank/Tank_Base_Color.png b/jme3-testdata/src/main/resources/Models/Tank/Tank_Base_Color.png index c021d42f2..f8e9fa50a 100644 Binary files a/jme3-testdata/src/main/resources/Models/Tank/Tank_Base_Color.png and b/jme3-testdata/src/main/resources/Models/Tank/Tank_Base_Color.png differ diff --git a/jme3-testdata/src/main/resources/Models/Tank/Tank_Emissive.png b/jme3-testdata/src/main/resources/Models/Tank/Tank_Emissive.png index 7d7c3e45b..b1be607c7 100644 Binary files a/jme3-testdata/src/main/resources/Models/Tank/Tank_Emissive.png and b/jme3-testdata/src/main/resources/Models/Tank/Tank_Emissive.png differ diff --git a/jme3-testdata/src/main/resources/Models/Tank/Tank_Metallic.png b/jme3-testdata/src/main/resources/Models/Tank/Tank_Metallic.png index de7da8ba2..afe233143 100644 Binary files a/jme3-testdata/src/main/resources/Models/Tank/Tank_Metallic.png and b/jme3-testdata/src/main/resources/Models/Tank/Tank_Metallic.png differ diff --git a/jme3-testdata/src/main/resources/Models/Tank/Tank_Normal.png b/jme3-testdata/src/main/resources/Models/Tank/Tank_Normal.png index 3bb1a2620..20bb5f64a 100644 Binary files a/jme3-testdata/src/main/resources/Models/Tank/Tank_Normal.png and b/jme3-testdata/src/main/resources/Models/Tank/Tank_Normal.png differ diff --git a/jme3-testdata/src/main/resources/Models/Tank/Tank_Roughness.png b/jme3-testdata/src/main/resources/Models/Tank/Tank_Roughness.png index 2717275c3..41f6c0a73 100644 Binary files a/jme3-testdata/src/main/resources/Models/Tank/Tank_Roughness.png and b/jme3-testdata/src/main/resources/Models/Tank/Tank_Roughness.png differ