From f010f1be5985b0de6368edac2904be523a13ada3 Mon Sep 17 00:00:00 2001 From: Nehon Date: Thu, 19 Nov 2015 19:05:20 +0100 Subject: [PATCH] Fixed an outstanding issue with PBR lighting that was screwing reflection with normal maps. --- jme3-core/src/main/resources/Common/ShaderLib/PBR.glsllib | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jme3-core/src/main/resources/Common/ShaderLib/PBR.glsllib b/jme3-core/src/main/resources/Common/ShaderLib/PBR.glsllib index c9cdeed76..5979af533 100644 --- a/jme3-core/src/main/resources/Common/ShaderLib/PBR.glsllib +++ b/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); }