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

Increase Godot shading consistency with other real time PBR rendering software such as Blender Eevee, Unreal Engine, Unity, etc. #4818

Closed
mindinsomnia opened this issue Jul 6, 2022 · 4 comments · Fixed by godotengine/godot#63587

Comments

@mindinsomnia
Copy link

mindinsomnia commented Jul 6, 2022

Describe the project you are working on

Architectural environments.

Describe the problem or limitation you are having in your project

Godot's specular shading is not consistent with other software, such as Eevee, Unity or Unreal Engine.

In other PBR shaders, by default specular is usually set to 0.5, a physically plausible value, and only adjusted when artistic needs dictate. A specular property of 0.0, results in absolutely no specular light contribution what so ever.

Example, unreal engine:

firefox_6MjugayEsJ

firefox_Feif2dDp8N

With Godot this is not the case and the above image is not possible in Godot with the specular slider alone. The specular slider in Godot only slightly reduces the specular contribution, and can not reduce it completely to nothing. It is not possible to create a material in Godot without specular. It is only possible to increase the roughness to try to hide it, but doing so doesn't hide it completely.

WATCH: Here is a demonstration of how specular is treated in Eevee (also a PBR real time 3D rendering engine, in Blender).
WATCH: Here is the same demonstration in Godot. Note: Reducing the specular does not remove the specular completely, unlike in Eevee.

Why this is an issue:

Problem 1: Not all assets that will be used in Godot will be created solely and specifically for Godot. There is a large and active global market of buying and selling 3D assets for real time applications, and their materials are created with values and texture maps for specular that assume "Specular: 0.0" = No specular. By having different behaviour, all those assets look different in Godot and in many cases, don't look the way they should.

Problem 2: When PBR materials look different in Godot to other 3D software, it makes workflow with that other software difficult. Most detailed 3D assets are not going to be created in Godot directly, and instead will be created in external software, such as Substance, Blender, Marvellous Designer, etc. It's necessary for good workflow for the previews in viewports in these software to match Godot as much as possible. Artists shouldn't have to guess what their assets will look like in Godot after export. That results in trial and error, and slower workflow.

Problem 3: There are situations where, while not physically plausible, having no specular contribution is desirable from an artist perspective. For example, if one is attempting to fake a cutout or cavity in a surface, the presence of specular reflections across what should be a 'deep dark black hole / line cutout' would ruin the illusion.

Problem 3 example:
L3GrFTK2ZJ

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Adjust Godot's PBR shading algorithms to allow a the specular property to reduce specular contribution to 0 when specular is set to 0, to match the behaviour of Unreal Engine and Eevee.

Specular is a very important and component of the PBR equation, and matching the behaviour of other PBR renderers is important.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Clayjohn had a suggestion for how this might be adjusted a while back, link to their comment.

And had further thoughts here.

A simple on / off tickbox toggle for specular contribution will not be enough (see this proposal) as this is something which needs a 0.0 to 1.0 variable degree of control for artistry at a per pixel / texel level, to address Problem 3, and a simple on/off tickbox does not address Problem 1 or Problem 2. (See above).

If this enhancement will not be used often, can it be worked around with a few lines of script?

It would be used by all 3D applications that require real time PBR rendering.

Is there a reason why this should be core and not an add-on in the asset library?

PBR material rendering is core.

@mindinsomnia
Copy link
Author

Just an extra thought, there is a golden opportunity coming up to do this, with Godot 4.0.

Godot 4.0 will represent a breaking change in many respects, such as GDScript's many changes, and many projects being transitioned from Godot 3.x to Godot 4.0 will require a lot of adjustment anyway. This proposed change to PBR shading will result in slight differences for existing Godot materials that rely on the specular property, and in a sense is a breaking change too. So including it with Godot 4.0 may be ideal.

@Calinou Calinou added this to the 4.0 milestone Jul 6, 2022
@clayjohn clayjohn moved this to In Discussion in Godot Proposal Metaverse Jul 26, 2022
@clayjohn clayjohn moved this from In Discussion to Ready for Implementation in Godot Proposal Metaverse Jul 26, 2022
@Calinou
Copy link
Member

Calinou commented Jul 26, 2022

as this is something which needs a 0.0 to 1.0 variable degree of control for artistry at a per pixel / texel level

Should this be based on the roughness or metallic map? I don't think introducing a new specular map should be done in the default material, as it has a high potential for confusion and will reduce performance by making BaseMaterial3D even more complex than it currently is. (For reference, we're trying to do everything possible to simplify BaseMaterial3D and reduce its VGPR usage.)

There's a per-pixel SPECULAR global in the fragment() function in shaders, so custom shaders will still be able to set it on a per-pixel basis.

@clayjohn
Copy link
Member

as this is something which needs a 0.0 to 1.0 variable degree of control for artistry at a per pixel / texel level

Should this be based on the roughness or metallic map? I don't think introducing a new specular map should be done in the default material, as it has a high potential for confusion and will reduce performance by making BaseMaterial3D even more complex than it currently is. (For reference, we're trying to do everything possible to simplify BaseMaterial3D and reduce its VGPR usage.)

Its easy enough to just not insert the texture sampling code if no texture is used. That's what we do in 3.x so that we don't use more textures than necessary https://github.com/godotengine/godot/blob/6c8d9b8401560be1b10fb8ffa61964f7e713c03f/scene/resources/material.cpp#L521-L529

@WrobotGames
Copy link

WrobotGames commented Jul 28, 2022

The only problem that I have found with godot's PRB rendering is godot's build-in light shader doesnt use the SPECULAR value as it should. (Explained in #godotengine/godot#63509 ). Every other 'base' PBR property works well (ALBEDO, METAL, ROUGHNESS)

It's just the SPECULAR that's incorrect and only when its NOT 0.5 (The default), to fix this there just needs to be a change somewhere in the rendering process (probably the build-in shaders, but I'm not an rendering expert...). The solution isn't another slider, this is only going to be confusing for artists coming from other software.

Godot 4.0 will represent a breaking change in many respects, such as GDScript's many changes, and many projects being transitioned from Godot 3.x to Godot 4.0 will require a lot of adjustment anyway. This proposed change to PBR shading will result in slight differences for existing Godot materials that rely on the specular property, and in a sense is a breaking change too. So including it with Godot 4.0 may be ideal.

There will be a slight difference in existent Godot materials (Even though only 1 percent of materials use the specular property, according to the unreal engine docs), which indeed means it can be called a breaking change. Because of that this feature should be in Godot at the feature freeze (3 august) I'm afraid that its already too late for that date. Even if a pull request that fixes this gets created after that date, I think it should still be accepted, because fixing Godots PRB shading to be the same as the industry should be a top priority. (The first Beta should be in september, that should be enough time if someone picks this up)

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

Successfully merging a pull request may close this issue.

4 participants