godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.43k stars 20.25k forks source link

Metallic PBR is broken with ambient environment lighting #10216

Closed fracteed closed 7 years ago

fracteed commented 7 years ago

Operating system or device - Godot version: Win 10 Godot 3 current build

Issue description: When environment>ambient light>sky contribution is at 0, materials behave as you would expect. In the first image, the sphere on the left is full metallic(1) with a roughness of 0.2. The sphere on the right is a dielectric material (metallic = 0) with roughness of 0.2.

The image looks as you would expect, with the rough metal sphere on the left receiving reflections from the environment, and no need for any ambient lighting from the environment HDR. The dielectric sphere on the right has some reflections but since there is no lighting in the scene(ambient or lights) it looks black. All is good!

sky_contrib1

In this next image, the environment>ambient light>sky contribution is set to 1 (which it should be as the new default). The dielectric material on the right is as you would expect, since it is now receiving ambient light from the HDR. However, the metallic sphere on the left is now looking very incorrect, even though the material has not changed since the first image.

It should look the same as it did in the first image, but for some reason the environment ambient light is effecting it(It is fully metallic/reflective so shouldn't be effected by ambient light). It looks like it is multiplying the ambient value over the reflection. This also occurs when a procedural sky is used instead of the HDR.

sky_contrib2

Steps to reproduce:

-change environment>ambient light>sky contribution to 1 with a sky(hdr or procedural) -add a mesh with a full metallic material

Link to minimal example project:

broken_metallic.zip

raymoo commented 7 years ago

This is a very well-optimized issue description

HummusSamurai commented 7 years ago

Has this been solved by https://github.com/godotengine/godot/commit/3a4ff3402dedab5f30b0f97aeadec6cf61f29a40 or is it a different bug? The left sphere in the 2nd picture seems to have similar color distortions as https://github.com/godotengine/godot/issues/10149 even if the material is rougher and less reflective in this case.

fracteed commented 7 years ago

@HummusSamurai Yes, this is now fixed! Could you or @akien-mga please close this issue.

himaghnam commented 7 years ago

i think tou can close thia issue as you are the one who created it

bojidar-bg commented 7 years ago

Closing as fixed by (probably) 3a4ff3402dedab5f30b0f97aeadec6cf61f29a40.