Fixes Lightmap handling in PBR shader

empirephoenix-patch-1
Rémy Bouquet 7 years ago
parent 950721f926
commit a6b86ad24d
  1. 8
      jme3-core/src/main/resources/Common/MatDefs/Light/PBRLighting.frag

@ -195,6 +195,8 @@ void main(){
vec4 diffuseColor = albedo - albedo * Metallic; vec4 diffuseColor = albedo - albedo * Metallic;
#endif #endif
gl_FragColor.rgb = vec3(0.0);
#ifdef LIGHTMAP #ifdef LIGHTMAP
vec3 lightMapColor; vec3 lightMapColor;
#ifdef SEPARATE_TEXCOORD #ifdef SEPARATE_TEXCOORD
@ -204,12 +206,14 @@ void main(){
#endif #endif
#ifdef AO_MAP #ifdef AO_MAP
lightMapColor.gb = lightMapColor.rr; lightMapColor.gb = lightMapColor.rr;
diffuseColor.rgb *= lightMapColor;
#else
gl_FragColor.rgb += diffuseColor.rgb * lightMapColor;
#endif #endif
specularColor.rgb *= lightMapColor; specularColor.rgb *= lightMapColor;
albedo.rgb *= lightMapColor;
#endif #endif
gl_FragColor.rgb = vec3(0.0);
float ndotv = max( dot( normal, viewDir ),0.0); float ndotv = max( dot( normal, viewDir ),0.0);
for( int i = 0;i < NB_LIGHTS; i+=3){ for( int i = 0;i < NB_LIGHTS; i+=3){
vec4 lightColor = g_LightData[i]; vec4 lightColor = g_LightData[i];

Loading…
Cancel
Save