Add modulate property to lightmaps.#120641
Open
Skywolf285 wants to merge 1 commit into
Open
Conversation
Member
Check how #109737 stores the specular intensity property in LightmapGI instead of LightmapGIData. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem(s) does this PR solve?
Adds a color property to lightmaps to multiple the final lightmap by. Effectively giving a limited way to alter the final lighting in real-time. Mostly useful to create day-night cycles but can have various other uses as well.
I already wrote a more detailed reasoning in godotengine/godot-proposals#14722
3.x) #49968Eyecandy, using just LightmapGI and a few gradients to control the sky and lightmap color:

Additional information
Will fully admit, I never touched C++ code so this entire thing is written using pattern observation, my best educated guess work and looking up basic C++ information whenever the syntax didn't make sense.
For the most part I'm pretty certain I did things the right way. The only thing I'm not certain about is how to update the lightmap captures. The problem I'm running into is that, to my knowledge, at no point a lightmap is aware what lightmap instances use it. Which is a problem because
LightStorage::Lightmap::modulatehas to be part ofLightStorage::Lightmapto be accessible in the shader whileRendererSceneCullneeds a lightmap instance to get theRendererSceneCull::InstanceLightmapDatato callRendererSceneCull::_instance_queue_updateon each of its geometries so the lightmap captures get properly updated.So in order for lightmap captures to update whenever
LightStorage::lightmap_set_modulateis called, did I store the lightmap instances for each lightmap inLightStorage::Lightmap::lightmap_instances. This feels like a very bad, hacky and error prone way to do things and requires each time a lightmap is assigned or removed to/from a lightmap instanceLightStorage::lightmap_insert_to_lightmap_instancesand/orLightStorage::lightmap_erase_from_lightmap_instancesto be called.I considered other alternatives but each has their own drawbacks. Would love to have feedback on this. There is very non-zero chance I missed a better option here!
Also not sure about the UX. Because
LightStorage::Lightmap::modulateis part of the lightmap does it appear underData/light_dataas part of theLightmapGIDatarather than underTweakswhere I feel it would be more logical. But to store the modulate property in both the LightmapGI node and theLightmapGIDataand carefully having to cover each scenario where these two might get out of sync doesn't sound great either. Not to mention it making it confusing where the modulate property is actually used.