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

Fixed an outstanding issue with PBR lighting that was screwing reflection with normal maps.

Nehon 9 жил өмнө
parent
commit
f010f1be59

+ 2 - 2
jme3-core/src/main/resources/Common/ShaderLib/PBR.glsllib

@@ -135,7 +135,7 @@ vec3 EnvDFGPolynomial( vec3 specularColor, float roughness, float ndotv ){
 vec3 ApproximateSpecularIBL(samplerCube envMap,sampler2D integrateBRDF, vec3 SpecularColor , float Roughness, float ndotv, vec3 refVec){
     //TODO magic values should be replaced by defines.
     float Lod = log2(Roughness) * 1.2 + 6.0 - 1.0;
-    vec3 PrefilteredColor =  textureCube(envMap, refVec.xyz,Lod).rgb;
+    vec3 PrefilteredColor =  textureCubeLod(envMap, refVec.xyz,Lod).rgb;
     vec2 EnvBRDF = texture2D(integrateBRDF,vec2(Roughness, ndotv)).rg;
     return PrefilteredColor * ( SpecularColor * EnvBRDF.x+ EnvBRDF.y );    
 }
@@ -143,7 +143,7 @@ vec3 ApproximateSpecularIBL(samplerCube envMap,sampler2D integrateBRDF, vec3 Spe
 vec3 ApproximateSpecularIBLPolynomial(samplerCube envMap, vec3 SpecularColor , float Roughness, float ndotv, vec3 refVec){
     //TODO magic values should be replaced by defines.
     float Lod = log2(Roughness) * 1.2 + 6.0 - 1.0;
-    vec3 PrefilteredColor =  textureCube(envMap, refVec.xyz,Lod).rgb;    
+    vec3 PrefilteredColor =  textureCubeLod(envMap, refVec.xyz,Lod).rgb;    
     return PrefilteredColor * EnvDFGPolynomial(SpecularColor, Roughness, ndotv);
 }