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

specular_disabled render mode in shaders does not make the SPECULAR output zero #95102

Closed
MajorMcDoom opened this issue Aug 3, 2024 · 3 comments · Fixed by godotengine/godot-docs#9691

Comments

@MajorMcDoom
Copy link
Contributor

Tested versions

Reproducible in 4.3.rc1

System information

Godot v4.3.rc1 - Windows 10.0.22631 - GLES3 (Compatibility) - NVIDIA GeForce GTX 1660 SUPER (NVIDIA; 32.0.15.6070) - Intel(R) Core(TM) i7-10700F CPU @ 2.90GHz (16 Threads)

Issue description

Screenshot 2024-08-03 121238
Setting the render mode specular_disabled does eliminate specular contribution from lights, but not reflected light. The SPECULAR output is non-zero in this case. If this is intended, the namings are very confusing and should be either changed or documented better.

Steps to reproduce

Open attached project, and look at the two balls side-by-side. Note that one is blacker than the other.
ball1 has the black shader, and ball2 has the true_black shader. Both shaders have the render mode specular_disabled, but only true_black explicitly sets SPECULAR output to zero. ball still receives reflected light from the WorldEnvironment in the scene.

Minimal reproduction project (MRP)

bug-report.zip

@Calinou
Copy link
Member

Calinou commented Aug 3, 2024

This is done by design. The specular render modes only affect direct light specular lobes, not reflected light. Changing this behavior would break visuals in existing projects, sometimes to a significant degree - on top of giving less control to users over the final appearance (since you wouldn't be able to disable specular lobes while keeping reflections anymore).

Set Metallic > Specular or SPECULAR to 0.0 to disable specular contribution entirely (all values below 0.02 do that): #63587

This is already documented here:

<member name="specular_mode" type="int" setter="set_specular_mode" getter="get_specular_mode" enum="BaseMaterial3D.SpecularMode" default="0">
The method for rendering the specular blob. See [enum SpecularMode].
[b]Note:[/b] [member specular_mode] only applies to the specular blob. It does not affect specular reflections from the sky, screen-space reflections, [VoxelGI], SDFGI or [ReflectionProbe]s. To disable reflections from these sources as well, set [member metallic_specular] to [code]0.0[/code] instead.
</member>

And here:

<member name="metallic_specular" type="float" setter="set_specular" getter="get_specular" default="0.5">
Adjusts the strength of specular reflections. Specular reflections are composed of scene reflections and the specular lobe which is the bright spot that is reflected from light sources. When set to [code]0.0[/code], no specular reflections will be visible. This differs from the [constant SPECULAR_DISABLED] [enum SpecularMode] as [constant SPECULAR_DISABLED] only applies to the specular lobe from the light source.
[b]Note:[/b] Unlike [member metallic], this is not energy-conserving, so it should be left at [code]0.5[/code] in most cases. See also [member roughness].
</member>

godotengine/godot-docs#9691 updates the manual.

@MajorMcDoom
Copy link
Contributor Author

godotengine/godot-docs#9691 updates the manual.

That PR definitely helps. Thanks!

@Calinou
Copy link
Member

Calinou commented Aug 5, 2024

Reopening, as the associated documentation PR hasn't been merged yet.

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

Successfully merging a pull request may close this issue.

3 participants