2
0
Эх сурвалжийг харах

Fixed wrong alpha handling in the pbr shader

Nehon 9 жил өмнө
parent
commit
9665b985e4

+ 4 - 2
jme3-core/src/main/resources/Common/MatDefs/Light/PBRLighting.frag

@@ -9,7 +9,9 @@ varying vec2 texCoord;
   varying vec2 texCoord2;
 #endif
 
-varying vec4 Color;
+#ifndef BASECOLORMAP
+    varying vec4 Color;
+#endif
 
 uniform vec4 g_LightData[NB_LIGHTS];
 
@@ -122,7 +124,7 @@ void main(){
         float Metallic =  max(m_Metallic, 0.0);
     #endif
  
-    float alpha = Color.a * albedo.a;
+    float alpha = albedo.a;
 
     #ifdef DISCARD_ALPHA
         if(alpha < m_AlphaDiscardThreshold){

+ 6 - 2
jme3-core/src/main/resources/Common/MatDefs/Light/PBRLighting.vert

@@ -13,7 +13,9 @@ varying vec2 texCoord;
   attribute vec2 inTexCoord2;
 #endif
 
-varying vec4 Color;
+#ifndef BASECOLORMAP
+    varying vec4 Color;
+#endif
 
 attribute vec3 inPosition;
 attribute vec2 inTexCoord;
@@ -59,7 +61,9 @@ void main(){
       wTangent = vec4(TransformWorldNormal(modelSpaceTan),inTangent.w);
     #endif
 
-    Color = m_BaseColor;
+    #ifndef BASECOLORMAP
+        Color = m_BaseColor;
+    #endif
     
     #ifdef VERTEX_COLOR                    
         Color *= inColor;