浏览代码

Add debugging to PBRTerrainTests to to help troubleshoot an unsolved rendering issue

This PR attempts to fix the issue that my previous PR unfortunately failed to fix: https://github.com/jMonkeyEngine/jmonkeyengine/pull/2365

I have made some more minor changes to the shader code that might fix it.

But I'm also going to update the PBRTerrain tests so users can easily toggle the DebugValuesMode debug view of each individual pbr layer so that issues like this are easier to troubleshoot in the future.
Ryan McDonough 6 月之前
父节点
当前提交
ca0a9f4d48

+ 5 - 1
jme3-terrain/src/main/resources/Common/MatDefs/Terrain/Modular/PBRTerrainUtils.glsllib

@@ -99,6 +99,8 @@
                     break;            
             }
 
+            finalAlphaBlendForLayer = clamp(finalAlphaBlendForLayer, 0.0, 1.0);
+
             return finalAlphaBlendForLayer;
         }    
        
@@ -210,7 +212,9 @@
    //_______________________________      
    
   //blend layer function. This mixes each layer's pbr vars over top of the current surface values based on the layer's blendValue
-        void PBRTerrainUtils_blendPBRTerrainLayer(inout PBRSurface surface, inout PBRTerrainTextureLayer layer){       
+        void PBRTerrainUtils_blendPBRTerrainLayer(inout PBRSurface surface, inout PBRTerrainTextureLayer layer){      
+            layer.ao = clamp(layer.metallic, 0.0, 1.0);
+            
             surface.albedo = mix(surface.albedo, layer.albedo.rgb, layer.blendValue);        
             surface.normal = normalize(mix(surface.normal.rgb, layer.normal, layer.blendValue));        
             surface.metallic = mix(surface.metallic, layer.metallic, layer.blendValue);