Skip to content

Commit 36aac25

Browse files
authored
Merge pull request #2334 from yaRnMcDonuts/patch-7
Fix incorrect metallic calculations in PBRLighting.frag
2 parents 8dd829d + 54fa111 commit 36aac25

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

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

+2-4
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,9 @@ void main(){
217217
Roughness = 1.0 - glossiness;
218218
vec3 fZero = specularColor.xyz;
219219
#else
220-
float specular = 0.5;
221-
float nonMetalSpec = 0.08 * specular;
222-
vec4 specularColor = (nonMetalSpec - nonMetalSpec * Metallic) + albedo * Metallic;
220+
vec4 specularColor = (0.04 - 0.04 * Metallic) + albedo * Metallic; // 0.04 is the standard base specular reflectance for non-metallic surfaces in PBR. While values like 0.08 can be used for different implementations, 0.04 aligns with Khronos' PBR specification.
223221
vec4 diffuseColor = albedo - albedo * Metallic;
224-
vec3 fZero = vec3(specular);
222+
vec3 fZero = mix(vec3(0.04), albedo.rgb, Metallic);
225223
#endif
226224

227225
gl_FragColor.rgb = vec3(0.0);

0 commit comments

Comments
 (0)