-
-
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 LightmapProbe placement workflow #7938
Comments
I'm not sure if we should go back to making people manually place their probes, given how time-consuming that process is. It should remain a last resort, not something you have to do because the automatic generation is ill-suited in most scenarios. Instead, it should be possible to guide the automatic probe system to only generate probes within the playable area. Maybe a NavigationMesh can be used as a helper here? |
@Calinou Here I was referring to that. Having something like an area where the probes can be generated automatically. I thought about NavigationMesh but is not always used in every scenario and I don't want to diverge the use of it for Lightmap. NavigationMesh should be only for navigation I created a simple script that does that as a proof of concept |
I made a script that places probes in a Vector3 distance from each other inside of a BoxShape as a POC. Is hard to see in the image (and also hard to work). The workflow is tedious and doesnt help much because the probes are placed in places that doesnt make much sense. Also that many probes in the scene stalls the Lightmap bake. I dont see any errors but it never finish this part Maybe its a good idea to implemente something like this to have them automatically and some way to restrict the interest areas. https://www.youtube.com/watch?v=n3ACAjlhgJQ |
Even just having individually-placed probes under a single multi-use node (like the LightProbes entity in Unity) that only reveals probe placements/allows editing upon selection would be a lot better usability-wise than what we have now. Otherwise the scene becomes an unusable mess of nodes.
Automatic generation is effective in theory but not in practicality. Unless you have an extremely smart and well-thought-out system there's too many individual problems that need to be fixed manually. Sometimes moving a probe 2-3 centimeters off the ground is enough to solve an issue, and there are some common hacks (such as placing a probe far above or below the level as a fallback for GI issues) that an automated system would never think of doing. |
Can you elaborate a bit your proposal? |
Sure! It's a little hard to explain when someone hasn't used the lightprobe system in Unity, but essentially: If you click the "edit probes" button in the inspector you can then edit the probes by duplicating and moving them. There's no need for an "add new probe" button since every Light Probe Group gives you 4 probes to start with, and you can simply duplicate more from there. You can find more specific info on how the system works HERE. This system is a lot less cluttered than Godot's current implementation. It doesn't need to be replicated exactly, but taking inspiration from some elements (such as a dedicated Light Probe Group node or hiding all light probes unless their parent node is selected) could be helpful. |
Yeah, thats something similar of what I have in mind. Also probes now are visible when you select the lightmap, if not they are hide. But I agree that showing them when they are selected its a good idea. In summary:
|
Yeah that sounds pretty usable to me. The novelty of the system will be the ability to auto-generate and then edit individual probes afterwards, that's something you always required a plugin for in Unity. Even just a basic 3D grid is better than nothing, with the user making a few adjustments here and there to move probes out of geometry or into more optimal positions. Some sort of cue to tell the user when a probe is inside geometry would be useful as well. One of the biggest problems with probes in Unity is that they draw over all geometry (definitely preferred to being obscured) but don't signify when they're inside a mesh. |
I was checking out the unity legacy probes system and the new adaptive probe system. The way the new adaptive way works is in a grid distributed way and check for invalid probes. Also probes light the meshes per pixel to give a better result. That could be nice to have as well. With this last thing probes position wont need to be that precise and a grid would work most of the cases. Also its would be awesome to bake probes separately from the lightmap since after baking the light, probe position may be adjusted |
On second thought, a node that adds in a cuboid area is perhaps not a bad idea. When you have a level like this, Godot will generate a lot of probes outside the playable area but overall probe density remains low: Lots of probes are also generated high up in the sky, which is wasteful if your dynamic objects barely leave the ground.
If we add a node that spreads LightmapProbes throughout an area, you could add LightmapProbe nodes as children to it. Regarding lightmap probe display in the editor, I noticed a few areas of improvement:
Partial x-ray display should be implementable using a second material pass that is transparent and disables the depth test. This one may be a good candidate for fading in the distance as to not look annoying in large scenes. |
If probes will only live inside a LightProbesGroup (to name it something) doesn't make much sense to have a LightmapProbe. I will suggest to have probes like gizmos and not like nodes.
This would be a great improvement
Yes to this |
In my opinion, something like this should not be core. Placing light/reflection probes has so many different uses cases for different games, the placement system would inevitably get huge, and every user would only need a fraction of it in their individual game.
Strongly against this. Having a node based probe enables users to write arbitrary placement editor scripts. |
Before we start launching into highly creative ideas it might be best to tackle what isn't working with the system as it exists right now, and lay down solutions out so we aren't inventing anything that doesn't improve the current system directly.
Unity solves all these issues with its implementation. I hate to compare to a major package, but that's the reality of it.
This strategy may give us room to expand with more features, such as:
I feel that this is mostly what we've landed on with current discussions. |
I have to repeat myself, this is a really, really bad idea. Do not do this. This is not one of Unity's good features. It will forever limit every single user to only being able to use your system. The LightmapProbe Node was created to avoid this specific issue: https://docs.godotengine.org/en/4.1/classes/class_lightmapprobe.html //edit: After re-reading your poposal, it seems that you're suggesting an optional "Probe Parent" node instead of replacing the currently existing probes with a single blackbox probe container node. Such an approach would be a nice addition. |
There’s no benefit afforded by adding lightprobe nodes as single nodes, instead of a grouped probe node system. If you want a single node, add a LightmapProbeGroup node and only one probe in that node. Quoting Godot’s recommended usecase isn’t an argument that it’s a bad idea. That’s just an explanation for why Godot is the way it is, not why the alternative is bad. You can work exactly the same with a grouped system: you can add detail where necessary (just duplicate more nodes) or opt to automate, combine automated domains with standard groups, or convert the automated domain to a standard group to manually edit it. I’m not sure what you mean by “it will forever limit every user into only being able to use your system.” As I mentioned earlier in the thread, being able to add a single probe as a node should remain a feature. I just don’t anticipate anyone preferring that over a grouped system, and I’ve personally never wished for Unity to offer a single probe over the probe group it offers. |
Ah, we're kind of on the same page then. Thanks for the explanation, much appreciated.
I misunderstood your system to be a "probe container blackbox" with no way of handling single probes on their own or manually altering/extending probe placement, similar to how UE4 did it a few years back with their Indirect Lighting Cache (I'm not sure if that's still the case today) and I thoroughly hated working with that system. I'm not entirely sure if I fully grasp the benefits and motivation behind the new system:
Is that correct? |
I like the idea. Also having all inside a LightmapProbeGroup could help to create the BSP in editor time so it doesn't take baking time and also create a valid one. |
@jcostello I'm not sure what you mean by BPS/BSP? |
For what I understand BSP is a way of subdividing space in which it generates a tree like data structures, AKA it links the probes in a tree structure. After baking you will see the probes linked by a line when selecting the GPULightmap. |
Yeah I think that should be live and calculated while editing. Seeing how the probes interconnect is pretty essential info when placing them. I forgot Godot doesn’t show that in real time until you mentioned it! |
@WickedInsignia if you like you can create a new proposal that supersede this one we all the details we came up to this point, including this point |
If you're fine with that, sure! I'll need a minute to pull everything together but will have it up as soon as I can. |
I have a working implementation of a LightmapProbe rework that lets it create multiple probes (without additional nodes): https://github.com/Calinou/godot/tree/lightmapprobe-add-probe-groups Cell size (defined in meters on each axis) is automatically adjusted so that the size is fully covered with probes, without any gaps or irregular spacing: If cell size is greater than the size on any of the dimensions, only one probe is generated on that dimension, but it will be centered: The default behavior is to use a size and cell size that generates a single probe in the middle, so that backwards compatibility is preserved: A manipulation gizmo and undo/redo are available, with the usual box helper found in 4.2 and later. I haven't copied over the subdivision drawing code from the VoxelGI gizmo yet. |
Very niceeeeeeeeeeeee, i love where this is going. Let me ask you a few questions:
What do you mean by this? Probes internally works like manually placed probes? Is there a possibility that make probes link in editor time, to solve potential problems before the lightmap bakes? |
The VoxelGI gizmo draws a preview of the subdivisions on the gizmo's faces. This could be added to LightmapProbe so you get an idea of how far away probes are spread before you bake lights, without looking too intrusive. |
could we get a preview using fake probes spheres semitransparent instead? |
Hello! I released a plugin that handles LightmapProbes, the idea is to make a grid of lightmap probes and cut unwanted ones. Here's a video (with cute sound :3): https://www.youtube.com/watch?v=IdpsFQpvp2I Unfortunately, it relies on collision to cut the unwanted probes. Ideally it would test the meshes themselves, but I didn't find a way to do it with GDScript. I tried RenderingServer.instances_cull_ray but it has 2 problems:
Is there any way to test for the meshes in the scene in GDScript? Maybe some shader trick? Speaking on shader tricks, the natural evolution would be to cut based on light information, is there any way to get lighting information in GDScript? Something similar to Unity's SphericalHarmonicsL2.Evaluate where you get the light information from a given direction, or some shader code to get the light information back to CPU. About the current proposal, would be really nice a way to know from which probes the object is getting the lighting, something like WickedInsignia proposed. I believe this would benefit on debugging errors (like on issue #82642): ProbesPreview.mp4 |
It's likely feasible to use SurfaceTool or similar, but it'll be slow in complex scenes. See godotengine/godot#83420. |
Hi, in my opinion the ability to add multiple separate lightprobe volumes to a scene and to be able to move individual ones around is very important for proper lighting of dynamic objects, especially in situations where the lighting in different parts of the scene varies a lot. An example from Unity: https://youtu.be/hMnetI4-dNY?t=2582&si=aHglM7SmkKDrxS30 Unity also has the ability to detect where automatically placed lightprobes are incorrect (for example inside geometry): |
I do agree that current LightmapProbe placement is too sparse when using "Gen Probes". Even with a Subdiv of 32, density is far too low. This room only has one probe!
This works great. Is it also feasible to increase the values of Gen Probes Subdiv beyond 32? |
Generating large amounts of probes is very slow, so values above 32 would be unviable until godotengine/godot#82915 is merged. If using a subdivision of 32 appears to make probes very sparse, it's because your level is pretty large in the first place, so you should rely on manual probe placement instead. This will give better results because you can exclude areas where dynamic objects will rarely appear (background scenery, high up in the air, and so on). I don't know if non-power-of-two values could be allowed so you can have more granularity. This could be interesting to do if possible, so you can select values in between 16 and 32 for example. |
Hello! I finished my probe placement tool a while ago, but completely forgot about this proposal 😅 It solves the manual placement part by making an easy way to create a grid of probes and have tools to cut the ones blocked by visible objects, or the ones that are far from visible objects. It's called LightmapProbeGrid and is available on this GitHub repository and on the AssetLib: https://godotengine.org/asset-library/asset/2475 |
Describe the project you are working on
3D Lighting
Describe the problem or limitation you are having in your project
Currently, working with Light Probes in large scene is tedious.
There is only who ways of working with Light Probes:
Subdivision in large scenes light the TPS demo does not do much. Even the 32 subdivision is not enough to cover the level since there is too much space between the probes and subdivision doesn't work by distance. Also, it places probes where the player will never go
Place Manually is really painful and not very accurate. I found that in order to have proper indirect lighting on dynamic object, it should be enough probes and they have to be close enough to guaranty a smooth transition and a good result.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Something like a node (LightProbesGroup or something like that) that consist in an area (like the ReflectionProbes) where Light Probes can be generated. With a parameter by distance so it could generate as much probes as the area can have by a separation of distance (probably distance in xz and y to generate more probes in in xz than in y)
This way, we can generate probes in desired areas with desired density of probes.
Also, probes of different areas should't be linked together unless areas overlap (To generate an accurate result and prevent dynamic object to the light from undesired probes)
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
N/A
If this enhancement will not be used often, can it be worked around with a few lines of script?
A script could place probes but workflow will still be bad.
Is there a reason why this should be core and not an add-on in the asset library?
N/A
The text was updated successfully, but these errors were encountered: