Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added radiance when using clear color #27898

Merged
merged 1 commit into from
May 14, 2019

Conversation

clayjohn
Copy link
Member

@clayjohn clayjohn commented Apr 10, 2019

Before when using a background other than sky, when METALLIC was greater than zero the mesh rendered black. Now, it takes into account background color when not using an environment map (not using sky).

before
metal-bug-col

after
metal-bug-fixed

Note: if our PBR implementation was perfectly energing-preserving, this sphere should be perfect white, but it is not. I'm going to look into that for a further PR, we should be able to approximate multi scattering and make our specular function closer to energy preserving.

Fixes: #27888

@clayjohn
Copy link
Member Author

I just added another change to this. I moved the computation of the environment brdf to the beginning where the radiance map is read from. A term that should have only applied to the environment was being used to scale the entire brdf, resulting in much darker rough metals.

before
ibl-wrong

after
ibl-right

And now our brdf is energy conserving again!
ibl-best

@clayjohn
Copy link
Member Author

@akien-mga i can split this up into two PRs. The background color stuff should not break compatibility. And the PBR correctness part can wait for 4.0 if we are worried about breaking projects. Although the difference is very subtle.

@reduz
Copy link
Member

reduz commented Apr 20, 2019

This should be left as-is I think. The current implementation is very confusing and this will most likely make it worse (It will break compatibility and users will be clueless about how to fix it, since previous behavior will not be possible anymore). For Godot 4, my plan is to separate the sources for indirect irradiance and reflections, so it would be more obvious what's going on.

@clayjohn
Copy link
Member Author

@reduz What do you mean? Previous behaviour is that as soon as Metallic goes above 0.0all meshes render completely black. There is no way that users rely on that behaviour. Any user would report that as a bug.

Plus there are many issues that have been opened related to this. see: #27322 and #21680

@akien-mga
Copy link
Member

As discussed on IRC today, there are some concerns on the impact this may have on existing projects. Yet it's also a clear bugfix, so the plan is to merge it, ask people to test the master branch on their projects, and assess anything that could be consider problematic in those projects.

Some changes needed based on today's review before merging, though.

@clayjohn
Copy link
Member Author

As per meeting discussion I will move the environment scaling to 1628 in GLES2 and to 2025 in GLES3

@clayjohn clayjohn force-pushed the metallic_radiance branch 2 times, most recently from 2dcfb16 to 5c25209 Compare May 13, 2019 19:25
@akien-mga akien-mga merged commit aa3c5f5 into godotengine:master May 14, 2019
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Metalness renders black when no environment map attached
3 participants