Skip to content

Commit a6b86ad

Browse files
committed
Fixes Lightmap handling in PBR shader
1 parent 950721f commit a6b86ad

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ void main(){
195195
vec4 diffuseColor = albedo - albedo * Metallic;
196196
#endif
197197

198+
gl_FragColor.rgb = vec3(0.0);
199+
198200
#ifdef LIGHTMAP
199201
vec3 lightMapColor;
200202
#ifdef SEPARATE_TEXCOORD
@@ -204,12 +206,14 @@ void main(){
204206
#endif
205207
#ifdef AO_MAP
206208
lightMapColor.gb = lightMapColor.rr;
209+
diffuseColor.rgb *= lightMapColor;
210+
#else
211+
gl_FragColor.rgb += diffuseColor.rgb * lightMapColor;
207212
#endif
208213
specularColor.rgb *= lightMapColor;
209-
albedo.rgb *= lightMapColor;
210214
#endif
211215

212-
gl_FragColor.rgb = vec3(0.0);
216+
213217
float ndotv = max( dot( normal, viewDir ),0.0);
214218
for( int i = 0;i < NB_LIGHTS; i+=3){
215219
vec4 lightColor = g_LightData[i];

0 commit comments

Comments
 (0)