Search Unity

  1. We've closed the job boards. If you're looking for work, or looking to hire check out Unity Connect. You can see more information here.
    Dismiss Notice
  2. We're running great holiday deals on subscriptions, swag and Asset Store packages! Take a peek at this blog for more information!
    Dismiss Notice
  3. Check out our Unite Austin 2017 YouTube playlist to catch up on what you missed. More videos coming soon.
    Dismiss Notice
  4. Unity 2017.2 is now released.
    Dismiss Notice
  5. The Unity Gear Store is here to help you look great at your next meetup, user group or conference. With all new Unity apparel, stickers and more!
    Dismiss Notice
  6. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  8. Unity 2017.3 beta is now available for download.
    Dismiss Notice

Light Probe Placement Helper

Discussion in 'Works In Progress' started by PhobicGunner, Nov 26, 2012.

  1. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    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 :)

    View attachment $LightProbeHelper.unitypackage
     
  2. fos4o

    fos4o

    Joined:
    Nov 27, 2012
    Posts:
    1
    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:
    View attachment $lightprobehelperfos4o.unitypackage
     
    Ony likes this.
  3. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    Nice, thanks fos :D
     
  4. Thomas-Pasieka

    Thomas-Pasieka

    Moderator

    Joined:
    Sep 19, 2005
    Posts:
    2,049
    I just tried (both versions) but it seems as it's failing. Is there an updated version perhaps?
     
  5. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    How is it failing? What version of Unity are you using?
     
  6. zyzyx

    zyzyx

    Joined:
    Jul 9, 2012
    Posts:
    186
  7. Poupi

    Poupi

    Joined:
    Jan 11, 2012
    Posts:
    92
    Same for me, not working.

    Code (csharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. LightProbeGenEditor.OnSceneGUI () (at Assets/LightProbeHelper/Editor/LightProbeGenEditor.cs:33)
    3. 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)
    4. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    5. 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)
    6. System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Applications/buildAgent/work/3df08680c6f85295/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    7. UnityEditor.SceneView.CallOnSceneGUI () (at C:/BuildAgent/work/812c4f5049264fad/Editor/Mono/SceneView/SceneView.cs:1335)
    8. UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at C:/BuildAgent/work/812c4f5049264fad/Editor/Mono/SceneView/SceneView.cs:839)
    9. UnityEditor.SceneView.OnGUI () (at C:/BuildAgent/work/812c4f5049264fad/Editor/Mono/SceneView/SceneView.cs:728)
    10. 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).
     
  8. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    1,909
    The first version works for me in 4.0
     
  9. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    1,909
    Fixed script from fos4o
    it works for me know
     
    Last edited: Jan 28, 2013
  10. FlorianSchmoldt

    FlorianSchmoldt

    Joined:
    Jul 2, 2012
    Posts:
    334
    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 !
     
  11. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    Now somebody just needs to add rotation and it'll be perfect.
    I'd do it myself but I have a pretty full plate >.<
     
  12. MetaMythril

    MetaMythril

    Joined:
    May 5, 2010
    Posts:
    126
    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.
     
    Last edited: Feb 3, 2013
  13. Adam-Buckner

    Adam-Buckner

    Unity Technologies

    Joined:
    Jun 27, 2007
    Posts:
    5,669
    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:
    [​IMG]

    Makes this pattern:
    [​IMG]
     
  14. eco_bach

    eco_bach

    Joined:
    Jul 8, 2013
    Posts:
    811
    Can this be modified to support tetrahedral as opposed to grid placement?
     
  15. Adam-Buckner

    Adam-Buckner

    Unity Technologies

    Joined:
    Jun 27, 2007
    Posts:
    5,669
    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.
     
  16. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    1,909
    Just curious why the lightprobe component not integrate/include similiar tool for probe placing?
     
  17. Adam-Buckner

    Adam-Buckner

    Unity Technologies

    Joined:
    Jun 27, 2007
    Posts:
    5,669
    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.
     
  18. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    1,909
    Yeah that's kinda true, also always using grid base are not really optimize i think