Closed Calinou closed 3 years ago
You are literally a couple of hours ahead of me! I wanted to create a proposal for adding a lighting environment. Because hiding the CPULighmapper adds ambient light, but the shading of the probes is lost. I'm waiting for a solution!
@JFonS I also don’t know, can I write here or create a new issue? When baking lighting, the GridMap cannot be hidden, it is always shown Also, I cannot disable it from baking. It is forcibly baked.
GridMap before bake
GridMap after bake
Godot 3.2.4 RC 4. Environment settings are still ignored. In particular, it is not possible to set any lighting if DirectionalLight is hidden. Objects become black and unnatural.
Yes, I'm working on adding an option to enable environment lighting on dynamic capture objects, but it didn't make it to the RC4 release.
Objects become black and unnatural.
In your case, this happens because the object is partially stuck in solid baked geometry. I'm not sure if we can fix this, but maybe we can add a way for meshes to sample their lighting position from a different position using an offset property. This way, you could move the sampling position to be located outside of solid geometry.
Maybe the solution could be made easier? If technically, of course, it's not more difficult to implement. Just turn off the use of recorded light and use only the environment. I don't know how it works internally, but I think it should help.
Just turn off the use of recorded light and use only the environment. I don't know how it works internally, but I think it should help.
The issue with using only environment lighting for dynamic objects is that the object will look out of place in nearly any situation. It won't receive any indirect lighting and won't be darkened if it's not in direct sunlight.
I'm adding a property in BakedLightmapData
that enables environment lighting for all the objects that use its "captured" lighting. From what I tested so far it looks ok and should fix your issues. But if that's not enough for your use case we can explore other options later.
I'm adding a property in
BakedLightmapData
that enables environment lighting for all the objects that use its "captured" lighting. From what I tested so far it looks ok and should fix your issues. But if that's not enough for your use case we can explore other options later.
Sounds good to me :slightly_smiling_face: Personally, I'd enable it by default as you'll probably want to always enable it unless your level is 100% indoors.
(Also, for 4.0, we should really harmonize the property names/values between "Use Environment" and "Interior", and enable exterior-friendly values by default in SDFGI where this isn't done currently.)
It is perfectly! I completely trust your solutions, with the next update I will definitely try and report everything! Finally, I would like to ask the last question. Is it possible to somehow limit the darkness? This means not turning the shadow completely black.
That is, in the same way, you can specify the color of the shadow from a light source, which can be not only black.
If this is not possible, your work is still amazing! And thanks to you, my game looks a million times better!
Is it possible to somehow limit the darkness? This means not turning the shadow completely black.
You should be able to define ambient lighting in the Environment resource to achieve this. You'll need to set a color other than black, increase the energy value and possibly decrease Sky Contribution as well.
If ambient lighting is currently not being taken into account by the lightmapper, I'd consider this to be a bug. That said, we may want to apply this ambient lighting in real-time rather than baking it into the lightmap. This allows changing the ambient lighting without having to bake the lightmaps again. This can be useful for special effects like thunder.
However, increasing ambient lighting too much will create a dull appearance. Instead, you can add subtle, shadow-less OmniLights to prevent specific areas from being too dark.
I hope I understood you correctly. However, baking with different options does not change anything here. This also applies to the sky influence settings. Changing the shadow color of the main DirectionalLight also does not change anything. After making changes to the settings, I will re-store the map. I tried solving this through adding OmniLight and it works. But their presence reduces the FPS, since the game is planned for Android.
I tried solving this through adding OmniLight and it works. But their presence reduces the FPS, since the game is planned for Android.
If you set the OmniLight's bake mode to All instead of Indirect, it shouldn't affect run-time performance in any meaningful way (other than making bake times longer).
Sounds good to me slightly_smiling_face Personally, I'd enable it by default as you'll probably want to always enable it unless your level is 100% indoors.
@Calinou Yeah, I added the interior
property, and it's disabled by default. I'm just trying to find a good way to update all the objects whenever the property is changed, since we currently don't have any relation to which objects are affected by each lightmap capture.
@SkanerSoft You should be able to set a custom environment for the bake. It's under the "Environment" section of the BakedLightmap
node properties. Normally you can set a custom color, and it will lighten up the whole scene, but I think there's a bug in RC4 which I will fix in the next release.
If you want to test right now how it will look, you can set a "Cutsom Sky", and assign a PanoramaSky
with a solid color image. This is the same as setting a custom color, so after the fixes it will be easier to use.
Ok, I tried all the options, and this is the result:
When using "Custom Color" - shadows are completely black When using "Custom Sky" - shadows are completely black When using "Scene" - shadows are completely black
I've tried changing the intensity and it only works on the lighter areas. They become super light.
And in those places where the shadow falls - everything is still black. This creates a very strong contrast.
The option with additional OmniLoght works, however, so that the FPS does not sag, you need to make them hidden or delete them after baking.
With OmniLights
However, this behavior is also quite normal.
Fixed by #46932.
@SkanerSoft The latest PR that was merged (will be available in the RC5 realease) adds the new property "Environment -> Min Light" in BakedLighmap
. That should give you some control over the darkest areas in the lightmap :)
See also https://github.com/godotengine/godot/issues/46332.
Godot version:
3.2
Git 4f891b706OS/device including version: Fedora 33, GeForce GTX 1080 (NVIDIA 460.39)
Issue description:
The new CPU lightmapper's dynamic object capture doesn't make use of the environment lighting. This occurs in GLES3 at least, but I remember it happening in GLES2 as well.
While peeking around in
scene.glsl
, I noticed there's code for environment lighting in the lightmap capture shader but I can't seem to find a way to enable it.BakedLightmap visible
Environment lighting is not used, only probe lighting is. This is fine in theory, but since the capture probes don't have environment lighting baked in, it looks bad.
BakedLightmap hidden
Environment lighting is used as the lightmap capture isn't used when the BakedLightmap node is hidden. Note that the lightmaps still affect the baked mesh though – whether this is a bug or not is a separate issue.
Steps to reproduce:
Add a BakedLightmap node, add two MeshInstances (one baked, one not baked), bake and move the non-baked mesh around.
Note that the DirectionalLight is hidden in the MRP to work around https://github.com/godotengine/godot/issues/46332.
Minimal reproduction project: test_lightmap_shadow.zip