-
-
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 support for vertex-based lightmaps #8062
Comments
Baking lightmaps to vertex colors was something I discussed with @JFonS at some point. It's feasible, but there are caveats:
The baking process itself would likely bake a lightmap texture as usual, but every vertex on baked meshes would then sample the texture using the vertex's UV2 coordinates then write a vertex color for the given vertex. The texture is then discarded as it's not needed anymore. Note that we don't expect Godot 3.x to gain large new rendering features, as most of the development focus is on Godot 4.x. |
Ah, I can tell there might be some issues, but I bet most of them wouldn’t be as noticeable. >B3c |
I know in unity the way they get around this is by multiplying either the albedo or vertex light channel by something like 16, then adjusting the baked light energy to match it.
If the light rays can be fired from vertices instead of from texels in a texture, it should, because one of the advantages vertex color baking has is that you can bake huge, huge scenes that would require massive amounts memory with a texture. with a texture we would have the same wait time and limitations. also, vertex lightmaps dont need a uv channel. |
Describe the project you are working on
I’m working on retraux/low poly turn based tactics game for mobile, and many of the game’s characters and assets look a lot like something out of a game from the 1990’s, so to help with the aesthetic, it would not just include low res lightmaps but also vertex based baked lighting.
Describe the problem or limitation you are having in your project
I’m already using the model’s vertex colors for other things like AO/specular, emissions, and material types, and taking how it’s part of the albedo and would multiply by the light and not add to it, it doesn’t work unless you make the light horrendously dim.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
An option on the baked lighting node that you can toggle on or off that can generate baked vertex lighting that goes through the lighting pass the same as its texture based equivalent, lightmaps. It’ll be affected by the lighting data resource the same as lightmaps, and it’ll interact the same to other lights like lightmaps, too.
It can also cast baked shadows and AO, too.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
I was thinking this baked vertex lighting system would be like a resource like its companion pixel lightmap with an array of colors in accordance to the vertices of the model.
Just light every vertex up during the pass.
As for toggling it on or off, it would be a flag the same for pixel based lighting.
As for it baking the actual lightmap, it’s the same as pixel based, but you would only need to trace and cast rays for every vertex over every voxel.
If this enhancement will not be used often, can it be worked around with a few lines of script?
You can do this by making a custom script and record all the lighting data for every vertices in an array and have it make a resource with that, but you would also need access to the lighting pass for this to work, which is disabled for vertex based shaders.
Is there a reason why this should be core and not an add-on in the asset library?
Oh! To be like an equivalent or companion to lightmaps you can turn off at anytime from the baked lighting node’s inspector.
The vertex based baked lighting system could be wildly efficient for massive worlds or if the levels’re blocky and doesn’t need pixel based lightmaps for it.
Think of like an option or an addition to smooth out shadows if you’re making, say, a PS1 retraux game where the vertex lighting’s there to smooth out the light and shadows for the point-filtered lightmaps.
It’s a popular genre, and this tool can definitely help with getting the vibe across.
The text was updated successfully, but these errors were encountered: