-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
Improve Ambient Light Rendering #5018
Comments
cc @clayjohn Is this a physically accurate change? This sounds like a form of fake contrast to me 🙂 Also, the way this is done in your shader makes ambient lighting brighter than intended. You should subtract some of the lighting when this feature is set to a value greater than 0 (so the average is identical). |
This doesnt seem physically accurate to me after checking how its done in unreal and blender. (And a bit of light theory) Basically every single material should get brighter the smaller the angle gets. (the Fresnel effect). (And this kinda is the opposite of what happens in the above images. Here is a sphere mesh in Godot, Unreal, and cycles. (Albedo = white, Metallic = 0, Specular = default (0.5), roughness = 0) I think that the material on the images that mrjustaguy had a roughness of 1 (Godots default). This effect ins't there in any of the real-time renderers that I tested. If this 'fake shading' were to be added to godot, it should be an option in the project settings, and should definitely NOT be the default. I hope this makes stuff clear :) |
At this point, I'd prefer to have a way to override BaseMaterial3D in a project so you can add your own customizations without having to use a ShaderMaterial everywhere. Project settings that are disabled by default will barely ever be used, so I'd prefer not to bloat the engine with optional tweaks like these. |
Please please, this would be so useful for many things. |
A slot somewhere in the project settings where you could use your own shader as defaultshader would indeed be really handy for projects with a more stylized art direction. |
This is a very cheap and very fake way to approximate ambient occlusion. Comparing the blender cycles render to the proposed implementation makes that very clear. This adds occlusion to every tangential surface in motion you will see the occlusion swimming across the surface of objects. It essentially is faking a large light source between the camera and object. In the cycles render you can see occlusion is only present in occluded areas (between the model's legs for example). In Godot you can achieve this looks by either specifying ambient occlusion maps in the baseMaterial (most accurate) or by turning on SSAO (easier but less accurate). I do not think we should add such a specific hack to the engine. |
Closing as a suitable workaround for the issue was found (Calculating irradiance with a Gradient 2d texture with the top being Bright and bottom being Dark, providing Neutral Lighting that also makes depth visible, while also being done in a single shader (sky shader) and easy to control) |
Describe the project you are working on
N/A
Describe the problem or limitation you are having in your project
Mono color (or low variance color) Ambient Lighting result in loss of Object Depth resulting in a Very flat look of Geometry.

This issue is also Present with other Ambient Lighting, (such as the Default Skies and the like) just not to the same extent, as the variance in lighting does add a little bit of the depth back
Left: Proposed
Right: Current
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Adding the depth to Radiance and Irradiance would resolve this issue at minimal performance impact.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Add the equivalent to these GDShader Fragment snippets To Shaders resolves this issue for both Metallic and Non-Metallic Materials when in the presence of low variance Ambient/Reflected Lighting
IRRADIANCE+=vec4(0.0,0.0,0.0,-clamp(dot(VIEW,NORMAL),0.25,1.0)*multiplier);
RADIANCE+=vec4(0.0,0.0,0.0,-clamp(dot(VIEW,NORMAL),0.25,1.0)*multiplier);
multiplier is a user controlled variable, that determines how strong the depth should be, and should be added to the Materials, a base of 0.5 should probably be default for best overall results, and value of 0 reverts to old behavior.
If this enhancement will not be used often, can it be worked around with a few lines of script?
Yes, but you have to create a shader for each material.
Is there a reason why this should be core and not an add-on in the asset library?
Drastically Improves Core Rendering.
The text was updated successfully, but these errors were encountered: