Sfoglia il codice sorgente

Updated the Tank maps, (SP2 generates smaller maps) also reverted last calibration changes as it was screwing up the real life models...

Nehon 9 anni fa
parent
commit
da9d38fee6

+ 1 - 1
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);
     }

+ 1 - 1
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);
 }

+ 4 - 2
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);

BIN
jme3-testdata/src/main/resources/Models/Tank/Tank_Base_Color.png


BIN
jme3-testdata/src/main/resources/Models/Tank/Tank_Emissive.png


BIN
jme3-testdata/src/main/resources/Models/Tank/Tank_Metallic.png


BIN
jme3-testdata/src/main/resources/Models/Tank/Tank_Normal.png


BIN
jme3-testdata/src/main/resources/Models/Tank/Tank_Roughness.png