Search Unity

[RELEASED] Raytrace Lightmaps | ShineSpark - Live Feedback, Subdivision, One Button UV Atlas Packing

Discussion in 'Assets and Asset Store' started by LightingInABottle, Jan 19, 2017.

  1. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115
    I have a version submitted to the store that should fix what you are seeing as well as bring the latest version to Unity 5.3 and 5.4. I don't think there is a difference between larger scenes with respect to the errors you were seeing. My guess is that the bug shows up when there are no lightmaps baked yet, because the auto loading gets caught in a loop.

    For directional lighting, it is something I will be working on after transparency. That being said, if you use a point light with its intensity set to 8 (the max in the unity UI for some strange reason) then put it far away, then tweak the range (sphere size) to give the brightness you want, you should be able to get crisp shadows.

    Keep in mind though that the sharpness of shadows can also depend on the resolution of the map. Here is an example of the above technique with a 512x512 map.


     
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,728
    Does this asset also bake light probes?

    Also when is support for spots and directional lights coming (which if I understood correctly, are not supported yet?).
     
  3. eastes

    eastes

    Joined:
    Sep 1, 2012
    Posts:
    59
    Bought it. Loved it. Reviewed. 5 stars. Will post screenshots when I finish tweaking.
     
    buttmatrix and Shodan0101 like this.
  4. David-Lindsay

    David-Lindsay

    Joined:
    May 20, 2009
    Posts:
    121
    That's great! I will try that out!
     
  5. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115
    You can bake light probes with unity's built in tools, but this does not bake the light probes itself. The submitted version (1.7.1) should be live in a few days and should make baking light probes easier (it won't let the maps gets wiped out when baking). Let me know if there are hurdles and frustrations with Unity's light probe baking, I've concentrated only on lightmaps so far.

    Right now my plan is to continue working on transparency, then work on directional and spot lights. Right now it supports area lights and point lights (treated as spheres with a radius of 'range'). While my experience is that most lighting situations can be served very well with area lights and point lights, it is mostly irrelevant at this point, since multiple people have asked for directional and spot lights. People want it so it is a priority for me. I will post my progress here.
     
    laurentlavigne and buttmatrix like this.
  6. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115
    I'm very happy that you like it, your review really helps validate the enormous amount of effort I put into making a tool that hopefully takes lighting from a painful experience to being the fun payoff after lots of modeling and texturing. If you send me a support email we can keep in touch. I've learned quite a bit from people who are working on full productions already. I'm excited to see what you do with it!
     
  7. David-Lindsay

    David-Lindsay

    Joined:
    May 20, 2009
    Posts:
    121
    Unfortunately, across uniform terrain, this causes very uneven lighting. Basically everything closer to the point light is brighter unless you get really ridiculous with range, at which point the samples start becoming very very spotty and inaccurate. But it works in theory up to a certain size!

    Waiting for your directional light support, thank you!
     
    buttmatrix likes this.
  8. macdude2

    macdude2

    Joined:
    Sep 22, 2010
    Posts:
    686
    Any chance you'll add in gpu solve support? Do you know if it would be possible to use the gpu and CPU simultaneously to solve the lightmap? That would make things go a fair bit quicker no?
     
  9. eastes

    eastes

    Joined:
    Sep 1, 2012
    Posts:
    59
    Although it worked great with a smaller scene, I'm having trouble with my 1km X 1km scene. I'll send support email and report back here.
     
  10. OP3NGL

    OP3NGL

    Joined:
    Dec 10, 2013
    Posts:
    267
    @LightingInABottle
    hi, in regards to my previous question, i realize the dark circle was actually a pointlight with no shadows, have since removed it, everything bakes out properly...

    We did an update to 5.5.1, previously was on 5.5.0f3 with the latest update of ur plugin to 1.7, now it takes forever to bake with ur default settings... the previous update with 5.5.0f3 took me only 2mins &47secs to bake...

    the new update, everything freezes there like forever.... Capture.PNG

    EDIT: finally it starts to render 30mins... WTF...
     
    Last edited: Feb 16, 2017
  11. eastes

    eastes

    Joined:
    Sep 1, 2012
    Posts:
    59
    You probably have the "Samples per pass" set very high. This means it runs a faster total time, but you see realtime updates less often.
     
  12. eastes

    eastes

    Joined:
    Sep 1, 2012
    Posts:
    59
    Instructions to emulate any directional lights you have in an outdoor scene.

    1. Use a point light a good distance from your scene. Mine is over 100m away from a 1000m scene.
    2. Make it a small range. Mine is 3.
    3. Give a massive intensity.
    4. Test it on low resolution settings and tweak it until you are happy with it.
     
  13. David-Lindsay

    David-Lindsay

    Joined:
    May 20, 2009
    Posts:
    121
    We have downgraded all workstations back to 5.5.0.

    About half the people in our team had problems with 5.5.1.
     
    Shodan0101 likes this.
  14. eastes

    eastes

    Joined:
    Sep 1, 2012
    Posts:
    59
    buttmatrix likes this.
  15. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    dude, just in the post above yours:
    "For directional lighting, it is something I will be working on after transparency."
     
    Shodan0101 likes this.
  16. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    Just an idea... could you scale the scene that works so it has a size of about 5Km²?
    And same, scale down the city so it has similar sice of the working scene? This way it might help to find where the issue is, may be its complexity not size. Even the dev suspects is other thing like no backed objects.
     
  17. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115

    I think this is likely a severe bug with the auto loading that causes a hand when there are no lightmaps created yet. I submitted a fix to the unity store two days ago but it hasn't been approved yet. As an emergency fix, you can replace the Assets/shinespark/LightingInABottle/scripts/*.cs files with the following updated scripts:

    http://shinespark.io/store/LightingInABottleId.cs
    http://shinespark.io/store/LightmapLoading.cs

    My mistake here was only testing this update on scenes that were already up and running. Hopefully the fix gets approved soon. I'm thinking of deprecating the package and if anyone wants to weigh in on whether that is the right thing to do, I would be interested in your opinion.
     
  18. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115
    That is super cool to see. My initial guess is that problems people are having with larger scenes can be solved by changing the ray bias.



    I would love to see the same rendered image with the ray bias turned up (it may need to go much higher than 4, this is just to show the control). I can also take a look at the scene and work on it myself in case the solution is not trivial.
     
  19. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115
    I deprecated the package and now wish that I hadn't. I wanted to take it down for a day or two while the next version gets approved so new people wouldn't encounter any large bugs, but only after did I see the message Unity puts up -

    "In most cases, package deprecation happens because the publisher is unable or unwilling to support the package anymore. We suggest looking for alternative packages or contacting the publisher directly."


    This is of course not at all true and it wasn't clear to me that this is what deprecation was for. If anyone is aware of any rollback features in the asset store that would work much better since the approval process takes many days and is unpredictable.
     
    Shodan0101 likes this.
  20. OP3NGL

    OP3NGL

    Joined:
    Dec 10, 2013
    Posts:
    267
    thank goodness its a mistake... i thought the package for done for..
     
    Shodan0101 likes this.
  21. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    time to contact unity support I guess
     
    Shodan0101 likes this.
  22. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115
    If anything I'm getting to the point where I can start to do the really interesting and cool stuff. Here is a preview of transparency mapping:



    The sphere has a single small point light inside, the green plane with the people has a vertically stretched area light behind it, and the plane with the tree has a small point light off to screen right.

    You can see that the people are blurred 'vertically' on the ground plane but not horizontally and the tree image gets softer as the colored shadow is further from the shadow caster.
     
  23. NERVAGON

    NERVAGON

    Joined:
    Oct 27, 2009
    Posts:
    73
    Nice!
     
  24. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115

    Were you able to use the '+' and '-' buttons to add and subtract selected objects to lightmaps? If this doesn't help I probably don't understand the problem yet.

     
  25. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    I need to review some of your earlier posts before I start asking questions - I think the answer is already on this forum.
     
  26. AlterSpace

    AlterSpace

    Joined:
    Jun 29, 2014
    Posts:
    34
    I would like to buy your asset, but I would like to know if the last version can be made compatible with Unity 5.4.4.
    If not, is the older version still available?
    And could you tell me if the "order of things to do" with this tool - at least for the older version - is right or not:
    1. Use the tool to bake the lightmaps
    2. Use the - awful - Unity built-in lightmapper to bake the Light Probes and Reflection Probes (removing the raytraced lightmaps baked before)
    3. Replace the LightmapData of the built-in lighmapper with those baked in the first step
     
  27. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115
    Hi AlterSpace, the backported version is now on the store. I have tested it with Unity 5.3 and 5.5. This means there shouldn't be a split like there was before, all versions should be the same and up to date.

    In your list for number 2, the probes can be baked alone with a drop down button inside Unity's 'Build' button. This version should also auto load the lightmaps if they are ever wiped by Unity. You can also stop the Enlighten maps from baking by turning off 'Baked GI' in the Lighting->Scene window.

    To put it another way - baking light probes without clearing the lightmaps should be possible and number 3 should not be necessary, though if you accidentally bake maps with enlighten you can press the tools->'Reload Lightmaps' button to get the Lighting In A Bottle maps back.
     
  28. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,728
    That was true for Unity 4, it's not true for Unity 5.
     
  29. AlterSpace

    AlterSpace

    Joined:
    Jun 29, 2014
    Posts:
    34
    If I disable the Baked GI in the Lighting Scene window, could I bake the Light Probes? I have only have the option for baking Reflection Probes alone or clear the LightmapData in that dropdown menu
     
  30. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115
    You are right, I wan't distinguishing between reflection probes and light probes. I'll look in to this more, there are still areas of enlighten that I know almost nothing about (like light probes!). Thanks for the correction.

    Many people interested in this tool out of frustration with enlighten probably know it much better than I do. It isn't clear to me yet if I should be thinking about light probes or reflection probes. Is it reasonable to say that light probes are a problem and reflection probes are not? If anyone wants to weigh in on that I am definitely open to knowing more about difficulties and work flows.
     
  31. AlterSpace

    AlterSpace

    Joined:
    Jun 29, 2014
    Posts:
    34
    So, right now, what is the workflow to have Light Probes and lightmap from this tool?
     
  32. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Unity 5.4.1f1 / Win10 / x64

    Warnings
    1. "UV scale for small meshes is equal to 0". Why - perhaps due to Auto UV mapping option?
    Issues
    1. LIAB tool window is disappearing after exiting play mode when docked.

    2. 'Samples Per Pass' is purely a UIX toggle and does not affect the quality of the final render?

    3. 'Ray Oversample' produces banding artifacts at higher values - might be helpful to include that note in the readme

    4. Does 'Reset Scale Offsets' or 'Pack UVs on unfolded (tight pack)' act as a global command that simultaneously affects all UVs for meshes that contain a LIAB ID script, or does it function as a piecemeal command that affects only the UVs for meshes that are selected in a given render group, e.g., 0, 1, 2, 3, etc. - must the command be executed for each render group one at a time (?)
    Suggestions
    1. Might be nice to include presets, such as "Preview" or "Production"; could you provide suggested settings for these hypothetical presets, or alternatively, the settings used in Adam Nerva's archviz demo?

    2. As far as I can tell - please correct me if I'm wrong - the issue with light probes is that, while you can bake the Enlighten lighting data into the light probes, and that data will persist at runtime to illuminate non-static objects, the Enlighten lighting data is qualitatively different from what LIAB is baking. The only way to compensate would be to painstakingly match the two lighting scenarios as best as possible, which is obviously a workflow disadvantage. (Not having issues with reflection probes since they can be baked separately from the lighting window build button drop-down).
     
    Last edited: Feb 19, 2017
  33. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    I've encountered a few artifacts I'd like to address, if possible:
    1. UV shell artifacts (black lines) on the sphere at a distance
    2. Noise on the shaded side of the cube
    Suggestions?

    Samples per pass: 8
    Total Samples: 256
    Threads: 4
    Bounces: 4
    Ray Oversample: 1
    Bias Mult: 1
    Resolution: 1024

    Screenshot (185).png Screenshot (186).png Screenshot (187).png
     
    Last edited: Feb 19, 2017
  34. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115
    My best (uninformed) guess at the moment is that you were right the first time - bake lightmaps, use enlighten to bake light probes and reflection probes, then press the tools->'Reload Lightmaps' button to get the original lightmaps back. I don't know of any way to prevent unity from replacing the scale offsets though, so it may mean baking the light probes in a separate scene.
     
  35. AndreElijah

    AndreElijah

    Joined:
    Sep 22, 2013
    Posts:
    15
    I sent you a message, about to pull the trigger and buy this plugin. Does it work with iOS/Android and Valve's Lab Renderer?
     
  36. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115

    Hi Andre, this produces .exr files which are loaded through a non-obsfuscated .cs script. The lightmaps should work on any platform where Unity is able to do this. As far as I know it should work everywhere but I haven't explicitly tested iOS or Android builds. I am not familiar with Valve's Lab Renderer, but if Enlighten's lightmaps work with it, I would guess these would too.
     
  37. AndreElijah

    AndreElijah

    Joined:
    Sep 22, 2013
    Posts:
    15
    Cool, thanks so much! I'll buy it this afternoon :)
     
  38. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115

    Can you copy and paste the exact warning message? Was it from Lighting In A Bottle or Unity? My guess would be that the scale in the scale offsets parameters is 0 in at least one dimension, which means that the UV for that object will have no area in the map. I haven't seen the Auto UV do this, but if you can repeat the problem I'm sure it can be fixed.


    1. I haven't been able to repeat this after trying it just now (I usually work with it un-docked). If you can make a simplified scene or any other way to repeat it I can probably figure it out. You can try going to windows->layouts->Revert Factory Settings to wipe out layout data but this is a bit of a stab in the dark.

    2. Yes, samples per pass is a trade off between interactivity and throughput.

    3. I haven't seen this happen as a result of ray oversampling. Are you sure that you aren't seeing faceting artifacts? The pics that you posted show faceting, which can be solved by turning up the subdivision levels. Be aware though that subdivision might not always do exactly what you want. On a cylinder it will try to subdivide the caps into a capsule shape and the lighting will not look right since the shape will change so much.

    4. Those tools work on the maps that are exposed/unrolled/unfolded in the UI. I realized that this combined with the fact that there are two separate buttons is not as elegant as it could be, which is why there is an 'Auto UV Atlas' button that works only on the single map that it goes with.


    For the suggestions:

    1. I'll keep that in mind. I've typically been rendering only one or two maps at a time and for interactivity I'll change the resolutions and maybe the samples per pass.

    2. That is a possible issue but I'm not familiar with it enough yet to really say. If I can get at the light probe data I could build features to render them myself. I'm just starting to look into this, I've seen the positions in the .unity file but I didn't see any color data.
     
  39. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    1. Switch_mesh: has no uv area due to 0 lightmap scale and won't be rendered.
      UnityEngine.Debug:LogWarning(Object)
      liab.Render:SetGeometry(GameMesh, Gcon) (at Assets/shinespark/LightingInABottle/Editor/Plugins/liabmain.cs:2183)
      liab.Render:ClearAndSetGeometry(rndrsettings, List`1) (at Assets/shinespark/LightingInABottle/Editor/Plugins/liabmain.cs:2254)
      liab.Render:RenderLightmaps(rndrsettings) (at Assets/shinespark/LightingInABottle/Editor/Plugins/liabmain.cs:2362)
      liab.liabmain:<OnGUI>m__1F() (at Assets/shinespark/LightingInABottle/Editor/Plugins/liabm

    2. Thanks for the tip, I have seen faceting artifacts, but I expected this. The banding I did not include an image of, but if you'd like I can reproduce the artifact so you can see
     
    Last edited: Feb 19, 2017
  40. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115
    First, check those objects to see if their scale offset parameters have any scales set to 0. This would mean that they would have no area in the map. The warning is just to make it easier to track down the problem.

    The second part is if the 'Auto UV Atlas' button set any of the scales to 0, which it should not do. If you know a way that I can repeat the button setting a scale to 0, send me mail at the support address and I will be able to look into it. We can also look at the banding. It may not be from the render, it may be from the quantization of the lightmap into a lower bit depth.
     
  41. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Right, I understand that a UV scale value of 0 will result in the mesh not being lightmapped, and that is what is happening (see attached), however I'm unclear what is causing this behavior. There seems to be a UV workflow when using this asset that includes:

    'Reset Scale Offsets' -> 'Auto UV Atlas' [or] 'Pack UVs (tight pack)' [or] 'Pack UVs (protect size)'.
    The last three options are doing a similar job of essentially atlasing and packing the UVs according to different algorithms.

    In my case, I've assigned some ceiling vents, light switches, electrical outlets, clock, and a smoke detector - small meshes - into a single render group. All three of the UV functions mentioned above, for whatever reason, prioritize some meshes over others in UV space, and result in zero-scale values for others.

    NOTE: I was able to solve this issue by regrouping the meshes into separate render groups, but that sort of defeats the value of texture atlasing in the first place.

    Capture.PNG Capture2.PNG
     
    Last edited: Feb 19, 2017
  42. AndreElijah

    AndreElijah

    Joined:
    Sep 22, 2013
    Posts:
    15
    Will there be Linux editor support once you wrap up Mac support?
     
  43. AlterSpace

    AlterSpace

    Joined:
    Jun 29, 2014
    Posts:
    34
    What scale offsets?
    Right now I'm working on a game that use light porbes and baked lights... What should I do exactly to make things work with your tool (if possible at least)? You have a scene with lightmaps created from LIAB and you need that light probes, what do you do?

    I fell in love with your tool (I passed two months trying to fight against artifacts with Enlighten), and in the end I had to change the whole lighting setup of the scene to avoid those problems. If I can have the light probes, I would be a very happy new customer and I could forget Enlighten and all those not-so-funny problems. Please make us forget Enlighten! :confused:
     
  44. CurtisMcGill

    CurtisMcGill

    Joined:
    Aug 7, 2012
    Posts:
    67
    Hi,

    I just bought your package yesterday and I need some help getting going. Newbie to light stuff. I am using the Abandoned park asset from the store. I need screen shots!!

    ERRORS
    • Lighting In A Bottle: List of maps to save was empty: no maps were saved. Check that at least one map is on, that there is at least one GameObject set to Lightmap Static and that its lightmap index is non negative.
    • Lighting In A Bottle: Nothing to render. Check that materials exist, are set to Lightmap Static, and have non negative Lightmap indices.

    HELP NEEDED
    • How to set Lightmap static on materials?
    • How do you set Lightmap indices?
    • How do you set GameObject to Lightmap Static?
    • Do you mean in the lights bake/realtime/static?
    • Do I need to turn on Models, Generate Lightmap UVs?
    • Do I need to turn on Models, Swap UVs?
    ADDITIONAL
    • Do I need to make changes in lighting?
      • The environment lighting
      • Precomputed Real-time GI
      • Baked GI
    Thanks for help
     
    Last edited: Feb 20, 2017
  45. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    [I am not the developer]
    1. You set meshes as lightmap static, not materials. You can do this by selecting the 'static' flag at the top right of the Inspector when a mesh is selected.
    2. In the LIAB tool window, there is an option in the Tool drop down menu to add LIAB ID script to all lightmap static objects - you must do this first. Next, you can manually choose what objects are placed into a render group by specifying the index number on the LIAB ID script on the relevant mesh. You can also use the + and - buttons in the render drop down of the LIAB tool window to add and remove selected objects from a given lightmap index
    3. When you import meshes, you should select "generate lightmap UVs"
    4. You do not need to swap UVs unless you are trying to swap the UV2 channel
    5. Turn off precomputed and baked GI lighting window, alternatively, deselect auto
    I would recommend spending some time reading, or following tutorials regarding the lighting workflow in Unity when you get the chance.
     
  46. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    @LightingInABottle I spent the better part of my weekend experimenting with this tool and it is indeed a powerful asset. However, some of these bake times are extreme.

    Most of my experimenting was conducted on an i5 / GTX 970 (4 threads) using the scene from my previous posts and this one (see attached) (*I did not create this screenshot*; Tirgames, "School Scene"). In the latter case, we're talking about >24hr bake times for 15-16 render groups, 512 default resoltion, and two render groups with 2048 resolution - 128 total samples; this seems to be the best sample count to ensure a smooth result.

    That being said, I am seeing [obvious] performance gains on an i7 / GTX Titan Black (8 threads).

    Gym.jpg
     
    Last edited: Feb 21, 2017
    AndreElijah likes this.
  47. CurtisMcGill

    CurtisMcGill

    Joined:
    Aug 7, 2012
    Posts:
    67
    Thank you for replying. The gym looks amazing!
     
  48. CurtisMcGill

    CurtisMcGill

    Joined:
    Aug 7, 2012
    Posts:
    67
    I have been looking at some youtube views, do you know of any good articles that will help?
     
  49. AndreElijah

    AndreElijah

    Joined:
    Sep 22, 2013
    Posts:
    15
    Do we know if the functionality in this plugin is CPU or GPU based? I'd like to know because it would determine whether I throw more CPU cores at it, or more GPUs.
     
    buttmatrix likes this.
  50. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115
    Possibly, I would like to do it, though I would have to know that it would sell a few copies to be worth doing it and pushing other features further out. Right now my list is basically transparency -> distant lighting -> mac -> maybe other lighting types.