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 2841ed8e3..9ce4e421b 100644 --- a/jme3-core/src/main/resources/Common/MatDefs/Light/PBRLighting.frag +++ b/jme3-core/src/main/resources/Common/MatDefs/Light/PBRLighting.frag @@ -148,18 +148,6 @@ void main(){ vec3 normal = normalize(wNormal); #endif - - #ifdef LIGHTMAP - vec3 lightMapColor; - #ifdef SEPARATE_TEXCOORD - lightMapColor = texture2D(m_LightMap, texCoord2).rgb; - #else - lightMapColor = texture2D(m_LightMap, texCoord).rgb; - #endif - specularColor.rgb *= lightMapColor; - albedo.rgb *= lightMapColor; - #endif - float specular = 0.5; #ifdef SPECGLOSSPIPELINE vec4 specularColor = texture2D(m_SpecularMap, newTexCoord); @@ -171,6 +159,17 @@ void main(){ vec4 diffuseColor = albedo - albedo * Metallic; #endif + #ifdef LIGHTMAP + vec3 lightMapColor; + #ifdef SEPARATE_TEXCOORD + lightMapColor = texture2D(m_LightMap, texCoord2).rgb; + #else + lightMapColor = texture2D(m_LightMap, texCoord).rgb; + #endif + specularColor.rgb *= lightMapColor; + albedo.rgb *= lightMapColor; + #endif + gl_FragColor.rgb = vec3(0.0); float ndotv = max( dot( normal, viewDir ),0.0); for( int i = 0;i < NB_LIGHTS; i+=3){