-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Add a Light3D bake mode that also bakes direct light for dynamic objects, and disables all real-time lighting computations #8040
Comments
Reposting my comment from godotengine/godot#73289 for posterity: I have a proof of concept: https://github.com/Calinou/godot/tree/light3d-add-static-baked-mode Testing project: test_light3d_baked_static_mode.zip It has some issues:
However, I was able to get a successful bake with lightmaps having the Static Baked lights present, yet dynamic objects not being lit by these lights in real-time at all. Light3D bake modes from left to right: Disabled, Static, Dynamic, Static Baked. The white box is a static (baked) object, while the cyan torus is a dynamic object. I'd appreciate help on this area as I'm not sure how to modify the lightmap probe baking code to get it to bake direct light for lights that use the Static Baked bake mode (and only those lights). |
@Calinou maybe Dario can help you since he worked in the implementation of the indirect light for probes |
@Calinou I'd like to get your branch running. I built the code. How do I set a light to be the new Static Baked mode? |
There's a Bake Mode property (or GI Mode, I forgot) in the Light3D inspector. Note that the branch isn't in a fully functional state yet, so you'll need to modify to be able to use it in production. |
These are the options for Bake Mode, just the same as in the trunk. light_3d.cpp line 380 from your branch. I don't want to use the branch for production. I want to help you get it working and have it merged into the trunk. I am a professional mathematician and I can take a look at the spherical harmonics stuff. |
@zomby138 I've force-pushed an update to the branch that rebases it against |
Id like to add that it would also be nice to have a GI mode which allows a dynamic mesh to contribute to the lightmap "cast shadows, bounce light, etc.." but does not use the lightmap texture and uses the baked light probes. an example would be tree foliage, where I dont have enough lightmap density to cover an entire forest, but would like the leaves to cast shadows into the lightmap and just use probes for lighting. this might be a separate topic from this proposal though. |
This is being tracked in godotengine/godot#96538. |
Describe the project you are working on
Retro FPS with a lot of baked light, where performance is important.
Describe the problem or limitation you are having in your project
It's not currently possible to make a light that is fully baked. No matter what you do, the direct light is still calculated in real time on dynamic objects. The direct light can be baked onto the lightmaps, but not onto the probes. With shadows on, this light is very expensive, and even with shadows off, it costs more performance than it needs to.
Sometimes you want to use a light to make a room a little lighter, like a local ambient light. For this it is very useful to be able to make a light that is 100% baked.
Also, some older games did all of their lighting via something like probes, and we should be able to make games that emulate that retro style.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
You could add a thousand fully baked lights to a scene without it costing any runtime performance whatsoever (because the overhead from using lightmaps and probes is constant, no matter how many, or few lights you have in your scene.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
There would be one more option in the "Bake Mode" drop down for a light. It could be called "Fully Baked", "Baked Direct", "Baked Only" or something.
A light with this setting would bake it's direct light into the like probes, in addition to the lightmap. Then at runtime the light node does absolutely nothing whatsoever. No being added to any clusteres, no calls to "void light()" in the shader of dynamic objects or anything.
If this enhancement will not be used often, can it be worked around with a few lines of script?
I don't think there is any way to work around this. If there it, I would be happy to do it.
Is there a reason why this should be core and not an add-on in the asset library?
It's core in other engines.
The text was updated successfully, but these errors were encountered: