From 9665b985e4c8565b6131dff2d360c04cff0ec458 Mon Sep 17 00:00:00 2001 From: Nehon Date: Fri, 19 Aug 2016 10:54:17 +0200 Subject: [PATCH] Fixed wrong alpha handling in the pbr shader --- .../main/resources/Common/MatDefs/Light/PBRLighting.frag | 6 ++++-- .../main/resources/Common/MatDefs/Light/PBRLighting.vert | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/jme3-core/src/main/resources/Common/MatDefs/Light/PBRLighting.frag b/jme3-core/src/main/resources/Common/MatDefs/Light/PBRLighting.frag index 27ea29aa4..0bd396383 100644 --- a/jme3-core/src/main/resources/Common/MatDefs/Light/PBRLighting.frag +++ b/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){ diff --git a/jme3-core/src/main/resources/Common/MatDefs/Light/PBRLighting.vert b/jme3-core/src/main/resources/Common/MatDefs/Light/PBRLighting.vert index 77782456b..c5cb00075 100644 --- a/jme3-core/src/main/resources/Common/MatDefs/Light/PBRLighting.vert +++ b/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;