I must admit, lightprobes are one of those things that make you wonder how the hell you survived without.
But I really hate that they have to be placed by hand. I REALLY HATE IT. Maybe I’m just a lazy S.O.B., but for levels bigger than a few meters wide, it can get incredibly tedious to place.
So I thought to myself, “Why not write myself an editor utility to do it for me?”
So I did. I wrote a utility that allows me to define a collection of AABBs, and for each one of these a probe density (either in Subdivisions when using grid placement, or Number of Probes when using randomized placement). And it’ll automatically place the light probes for you. Currently supported are Grid Placement and Random Placement types.
I hope somebody else can find this useful. Enjoy ![]()
Hi I made some changes that I think can be helpful to others:
- Gizmos for position and scale of the regions (Go to editor move mode to move, and in editor scale mode to scale the boxes)
- Undo (of movement and scale)
Here it is:
1096711–41206–$lightprobehelperfos4o.unitypackage (3.38 KB)
Nice, thanks fos ![]()
I just tried (both versions) but it seems as it’s failing. Is there an updated version perhaps?
How is it failing? What version of Unity are you using?
It seems that the link is not working ![]()
Same for me, not working.
NullReferenceException: Object reference not set to an instance of an object
LightProbeGenEditor.OnSceneGUI () (at Assets/LightProbeHelper/Editor/LightProbeGenEditor.cs:33)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Applications/buildAgent/work/3df08680c6f85295/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Applications/buildAgent/work/3df08680c6f85295/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Applications/buildAgent/work/3df08680c6f85295/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.SceneView.CallOnSceneGUI () (at C:/BuildAgent/work/812c4f5049264fad/Editor/Mono/SceneView/SceneView.cs:1335)
UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at C:/BuildAgent/work/812c4f5049264fad/Editor/Mono/SceneView/SceneView.cs:839)
UnityEditor.SceneView.OnGUI () (at C:/BuildAgent/work/812c4f5049264fad/Editor/Mono/SceneView/SceneView.cs:728)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Applications/buildAgent/work/3df08680c6f85295/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
Keep working guys, lightprobes are one of the best features in Unity but the GUI is awfull (UT should work on this).
The first version works for me in 4.0
Fixed script from fos4o
it works for me know
Wow ! I was planning to use Lightprobes but when I saw that they had to be placed manually, I instantly skipped the idea and used expensive IBLs
Thanks a lot for sharing !
Now somebody just needs to add rotation and it’ll be perfect.
I’d do it myself but I have a pretty full plate >.<
Can’t seem to download your attachment. Anyone else having the same trouble?
It takes me to a blank page. The other attachments download fine… odd.
This script seems to work for me, and so does the link to FOS’s version.
Using FOS’s version, just make sure you have enough data in the correct fields to not only define a volume, but to populate it, including the subdivisions. This script will create a regular grid pattern and ignore the Random Count value when the placement algorithm is set to “Grid”. The “Random Count” is only used when “Random” is selected.
This data:
Makes this pattern:
Can this be modified to support tetrahedral as opposed to grid placement?
I’m sure it can be. It’s only an editor script. It’s been modified already by the users in this thread. You will just have to work out the alternating offset yourself.
Just curious why the lightprobe component not integrate/include similiar tool for probe placing?
Well, everyone’s game is different. To be honest, you don’t need light probes in a grid and to do so is somewhere between overkill and bad for performance. What’s best is light probes on the boundary of lighting changes. One on one side of the change and another just on the other side. The range in between that boundary and the next large change in lighting doesn’t need probes most of the time. If that area was filled with probes, they are not really useful and are taking up resources. That being said, it’s easier to lay down a bunch of probes quickly with a script.
Also, don’t forget that this script was written years ago and light probes have advanced somewhat, so before jumping into this script, you may want to check out light probes in a scene and see if they work for you as they are.
Yeah that’s kinda true, also always using grid base are not really optimize i think