Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

[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
    First, that shot looks pretty great and I would love to feature it or something similar on the asset store page with whatever credit you like. If you are interested mail me at support at shinespark io. Also thank you very much for answering user questions!

    For the render times, I recommend playing around with ray oversampling if you haven't already. 16 maps rendered at 512x512 resolution is a lot of rendering to be sure. More lights will also mean a lot more rays per sample and so will slow down the sampling. If you can cut out lights out of maps where they don't have much influence that can save a lot of time, as can not using more bounces if they won't make a difference. That all being said there are multiple large algorithmic improvements that I want to do to speed up rendering times once the interface and features are smoothed out a bit.
     
    buttmatrix likes this.
  2. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115
    It is purely CPU based. I plan to make deep algorithm improvements before attempting any GPU rendering.
     
  3. AndreElijah

    AndreElijah

    Joined:
    Sep 22, 2013
    Posts:
    15
    I'll be honest - right now I'm using Win10 for development but absolutely hate it as a production environment. Random applications have memory leaks, forced updates have initiated reboots that cancel light builds when I was using UE4, and ads on my Start Screen (even on Win10 Pro). Once Valve enables Steam VR for Linux I'd like to use Linux strictly as a workspace to get stuff done, and use Windows for gaming/testing. If your plugin managed to work on Linux - I'd buy another 5 licenses just for myself as support.
     
  4. AndreElijah

    AndreElijah

    Joined:
    Sep 22, 2013
    Posts:
    15
    Cool - are there any plans to enable network based rendering to allow different desktops on the network to join in and share the load?
     
    buttmatrix likes this.
  5. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    *I did not create the screenshot from my previous post*
    The screenshot was taken from Tirgames "School Scene" which can be found on the Asset Store. That being said, if you are interested in featuring user artwork, I would be happy to share some screenshots when I'm finished.

    No problem, and thanks for your suggestions, that helps a lot!
     
    Last edited: Feb 21, 2017
    Shodan0101 likes this.
  6. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    That court with higher normal map resollution on the floor would be like a real photo. Looks freaking aaaaaaaaaawesome.
     
  7. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
  8. AndreElijah

    AndreElijah

    Joined:
    Sep 22, 2013
    Posts:
    15
    Is there an actual step by step guide on how to use this plugin? I'm new to Unity, and am testing an Evermotion scene right now. The only UVs that exists are on Channel 0 for the Texture/Material. Will this plugin also pack/generate the UVs on Channel 1, then render?

    Right now after importing a mesh into an otherwise blank level - Lightning tells me that "List of maps to save was empty: no maps were saved."
     
  9. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    There is a readme inside the package, it is fairly straightforward. You should consider whether the lighting arrangement in your scene is appropriate for this plugin, which currently supports area lights and spot lights.
     
  10. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115
    You should be able to select geometry and press the '+' button next to a map index, which will add that geometry to the map, mark it as lightmap static, and put an Id component on it.

    If you change the lightmap index on the object to an index that isn't in the main rendering UI, you should see another map index be created.
     
  11. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    I'm having some issues with the rendering index, where after going through and manually assigning indices to meshes, the rendering UI does not update the list of render groups correctly.

    NOTE: This can be solved by putting everything into one group, then manually assigning to separate groups (?)
    1. Would be nice to be able to manually add a render group, then assign meshes to that group with the + button.
    2. Would be nice to be able to label render groups (low priority)
    3. Why is 'number of bounces' currently limited to 6?
    4. What is the maximum number of possible render groups (I'm maxing out at 20)
    Area Lights and Visual Quality
    1. There is no control over the effective range of area lights in Unity - I think they default to 10m (?) - and consequently, since directional lights are not yet implemented, you run into situations where you need more voluminous lighting to fill open architectural spaces, but cannot increase the intensity without blowing-out the exposure for nearby surfaces. Obviously, including some point lights to fill the area is possible, but this can lead to inauthentic light distribution, that while suitable in many static renderers, is either not ideal for performance reasons, or not ideal for physically based reasons. Any thoughts on this?
    2. I'd also like to note that I'm getting very reasonable lightmapping results for large architectural features at 128 samples, 128 resolution, which is great and really enhances my workflow.
     
    Last edited: Feb 22, 2017
  12. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115

    1 I agree this would make the interface better.
    2. Someone else mentioned this and I agree that it is worthwhile but a lower priority
    3. That is an arbitrary limitation that I will lift in the next release. I think it is unlikely that most situations will benefit from large numbers of bounces due to diminishing returns in quality but linear increases in render time, but I also think that people can figure it out for themselves and shouldn't face arbitrary restrictions that are to protect less experienced users.


    1. Area lights in this renderer have no distance limit because that is not something that lights have physically. It would however be nice for optimization. Have you tried increasing the size of the area lights? Larger area lights means less fall off over distance, which means you can turn down the intensity and not have such a sharp brightness change from close to further away.

    2. Great to hear. Working at lower resolutions is almost always a good workflow with lighting.
     
    buttmatrix likes this.
  13. AndreElijah

    AndreElijah

    Joined:
    Sep 22, 2013
    Posts:
    15
    Is there a way to delete objects from the selection, or just straight up delete groups that were created in the plugin? Right now when I open the window the attached image happens. There are about 30 objects in my scene, with four lights. I can get the plugin to work on a fresh level with Unity generated meshes, no problem.

    Ideally I'd like to delete all of the selections, select them again starting fresh, and attach all of them to a 4K lightmap generated by Lightning In A Bottle.

    Any help would be REALLY appreciated.

    For reference - I'm trying to create an ArchViz scene that looks like it would be created by Koola, the guy who works miracles with UE4.

    Thanks so much!
     

    Attached Files:

  14. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115

    You can select objects and press '-' to take them out of a lightmap. You can also use the tools->'delete unused lightmap indices' button to clear lightmaps that don't have any geometry under them. The select button on each map selects all geometry in that map.

    I've never seen interface artifacts like that before, so send a support email if resizing/closing the window doesn't work.
     
  15. AndreElijah

    AndreElijah

    Joined:
    Sep 22, 2013
    Posts:
    15
    Email incoming :)
     
  16. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Noticed that using an area light as a directional light really doesn't simulate properly in terms of the shadow casting (see LIAB_AL vs LIAB_DL (Enlighten Baked GI with directional light). Also, I noticed indirect bounce lighting for point lights is supported by LIAB, very nice. Is it some sort of diffuse multiplier?

    LIAB_AL.PNG LIAB_DL.PNG
     
  17. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115
    If you want more parallel rays from the area light you will need to pull it back much further and turn up the intensity / enlarge the area to compensate.

    Indirect bounce lighting is supported by any light, the bounces just have to be set above 0.

    Let me know if that answers your questions, I'm not sure what you mean by diffuse multiplier.
     
    buttmatrix likes this.
  18. chalitnc

    chalitnc

    Joined:
    Aug 9, 2012
    Posts:
    13
    Having created the light maps, is it normal for there to be very long delays when playing the scene, switching to the scene, or when exiting play mode in the editor? This delay is not present in builds.
     
  19. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Yes, I have also witnessed this, although I would say ~10 sec.

    There is a fairly messy interplay between area light distance, size, intensity, and position required to simulate directional lights properly, but I appreciate your advice regarding parallel rays. Looking forward to directional lights after transparency.

    Also, seeing some issues where lights are canceling each other (?) See attached 'LIAB_AL', you can see an area light only, casting approximately parallel shadows, but when a point light is added, the point light radius is interfering with the area lights (see #24).

    You have a sort of fill / key light arrangement in the LIAB demo scene, but this issue is not observed.

    LIAB_AL.PNG LIAB_PLAL.PNG
     
    Last edited: Feb 23, 2017
  20. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115
    Can you give me a ballpark of the times and the resolutions of the maps (and number of maps)? I haven't seen this myself (yet) but Unity does wipe the maps and they have to be reloaded on play. I'll also see if I can do less when reloading during play.
     
  21. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115

    The point lights end up as spheres that can also shadow other lights right now. I do want to change this, but in the current version the sphere around the light is treated as geometry.
     
    buttmatrix likes this.
  22. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Banding I referred to in an early post at higher ray oversample (36)

    Will area light dimensions create a similar occlusion problem, or is it safe to put an area light in front of a point light?

    Also, I've had some success with an area light inside a point light, at the expense of more parallel rays.

    (original) (high contrast) (area light inside point light)
    LIAB_bands.PNG LIAB_bands2.png LIAB_AL-PL.PNG
     
    Last edited: Feb 23, 2017
  23. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115
    An area light will be treated as a plane and also occlude at the moment.

    For the banding you are seeing, I think it is unlikely to be coming from the renderer. If you try rendering at a very low resolution you can probably see in the raw .exr image that the pixels will be too course to be responsible for the banding. If you look at the interpolated image by clicking on it in the GUI you will be able to see it as a smooth gradient.

    Here is an example of a low res render (32x32) image. You may be able to notice tiny banding in the darks, even though that banding is much smaller than the pixels themselves.

     
  24. chalitnc

    chalitnc

    Joined:
    Aug 9, 2012
    Posts:
    13
    Certainly.

    samples 0.25
    total samples 16
    threads 14
    bounces 2
    ray oversample 4
    bias mult 4
    resolution 256
    3 maps @ 2048

    It takes around 30 seconds from clicking play to being able to actually play it where it would be 2 seconds before. Stopping takes around 5-6 seconds. Is there any way around Unity having to wipe and reload them?
     
  25. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115
    I don't know of any way to stop Unity wiping out the lightmaps though I may be able to reload them quicker by using the more direct loading used for the build when switching into play mode.
     
  26. AlterSpace

    AlterSpace

    Joined:
    Jun 29, 2014
    Posts:
    34
    I bought your tool... From what I've seen until now, it's really better than Enlighten, but I found a few problems that I can't explain:
    1. a non-static mesh receive the lightmap (it doesn't have any Liab ID). All the other non-static mesh in the scene don't have this problem.
    2. two aligned area lights, oriented towards a plane under them, create different kind of illumination, with one of them that looks traslated and parallel to where I expected to be (and moving that area light in the opposite direction solved the problem - so I ended with two area light that are not aligned but produce aligned illuminated zones)
    3. after a few tempts with the tool working fine, it happens that - for an undefinded time - if I click again on "Render" it simply freezes without starting. Unity still works, CPU workload on 20/30 % but no lightmap baked. I bought the plugin six hours ago and happened to me twice, without changing any parameter in the LIAB window, but only disabling the "Lightmap Static" property on a object. Now, if I could bake again the last working setup, I could post a screenshot of the point 1 and 2
    By the way, what's your email? I could send you an example of the points 1 and 2 and see if it's only a problem for me.

    EDIT: I think that problem 3 was a ProBuilder problem, I rebuild the UVs for the entire scene and the tool started work again. A 1 cm movement of a vertex creates problems and I could replicate the problem in that way, so for all ProBuilder users out there, you have to rebuild the UV layout from the menu every time you make change, before bake.
     
    Last edited: Feb 25, 2017
  27. AlterSpace

    AlterSpace

    Joined:
    Jun 29, 2014
    Posts:
    34
    Here are the picture of the problem 1 of the previous post (actually the non-static object were 2):
    - the first mesh renderer - a glass one - without LIAB ID and not set as lightmap static (the material has no textures, it's only transparent)
    Screenshot (122).png
    - the second one, right under the glass of the previous screenshot
    Screenshot (119).png
    The second one shows the entire lightmap on it, don't ask why o_O
     
  28. AlterSpace

    AlterSpace

    Joined:
    Jun 29, 2014
    Posts:
    34
    And then I would add this problem:
    - two identical point lights (as you can see I have selected both of them in the screenshot below), one working and one not at all.
    Screenshot (123).png
    Screenshot made at 10 % of the render, but the area behind the tired point light is the darkest of the map, when it shouldn't be like that.

    EDIT: I think it's another ProBuilder related problem, so in areas that are not ProBuilder created this tool works like a miracle, otherwise with Enlighten I can build lights - with artifacts - and with LIAB I can't...
     
    Last edited: Feb 25, 2017
  29. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115

    I think there are a couple of things to clear up here. First, the 'lightmap static' flag is not what dictates if an object will use the lightmap. Ignoring the shader, that is dictated by the renderer.lightmapIndex. You can reset this by removing the Lighting In A Bottle component and going to the lighting window->lightmaps and pressing 'Clear Baked Data' under the build button. I'm going to see if the '-' button setting the index to -1 makes sense (which is the default non-lightmapped value).

    A second part is the scale-offsets values. These are an extra layer for UVs that dictate a box where a mesh's uvs end up on a map. When you use the 'Auto UV Atlas' button, it is laying out these scale-offset values but not actually changing the individual vert's UV values. On your floor that shows the entire lightmap, it likely has scales of 1,1 and offsets of 0,0, making its UV bounds cover the whole map. If this was not how the lightmaps were rendered, they won't line up and will look wrong.

    I don't know anything about ProBuilder but you can visualize the uvs that will be used by Lighting In A Bottle by selecting an object with its lightmap open.

    When you say the area behind the point light 'shouldn't be like that' what do you mean? If you turn the intensity of the point light up in intensity and/or take it up in size does it not illuminate the geometry?
     
  30. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    I feel like these artifacts are fairly unusual for a +17hr bake at 2048 res, 128 samples (8 threads) (Win10, i7, gtx Titan Black).

    1.PNG 2.PNG
     
    Last edited: Feb 26, 2017
  31. AlterSpace

    AlterSpace

    Joined:
    Jun 29, 2014
    Posts:
    34
    As I said the two lights are exactly the same, the first - on the left - was illuminating the wall and the second one, that was a copy of the previous one, was not illuminating anything. I expected to have some kind of bright area around the second light, as the other one.
    For the lightmap on meshes without the Lightmap Static flag, I had already removed the LIAB Id component from them (as you can see in the screenshots I posted, the inspector for each of those mesh doesn't have any LIAB component).
     
  32. AlterSpace

    AlterSpace

    Joined:
    Jun 29, 2014
    Posts:
    34
  33. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115
    Noise in ray tracing depends a huge amount on how the scene is structured and where the illumination is coming from. If illumination is making it to a surface only after multiple bounces, the amount of samples it will take to get the noise out rises considerably, because the amount of samples and paths that actually make it to a light source drops dramatically.

    I would recommend putting lights where the outside light hits the floor. This will give you more control over the bounce light and should dramatically decrease the amount of noise in your maps.

    Also higher resolutions will mean more noise because they have more detail. Higher resolutions may be needed to get all the lighting detail you need, but because of interpolation, even lower resolutions will be smooth.
     
    buttmatrix likes this.
  34. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115

    I would need to see the scene to look at the light problem. You can always send me mail at support at shinespark io. Have you checked if other lights illuminate that wall? Are you sure that there are no UV coordinate overlaps?

    After you removed the Lighting In A Bottle component, did you clear the lightmap data in Unity's Lightmaps window? That is the part that sets the lightmapIndex back to -1.

    Thanks for the link to the thread, I will take a look at it.
     
  35. OP3NGL

    OP3NGL

    Joined:
    Dec 10, 2013
    Posts:
    267
    @LightingInABottle
    when i render pointlights in my scene, the plugin also render the point surface like a hard shadow even when i set it to no shadows
     
  36. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115
    Hey OP3NGL, to stop individual shadows from an object you can set it to 'no trace'. Shadows for a light as a whole can not be turned off, as that would just give the effect of a real time light.
     
  37. NERVAGON

    NERVAGON

    Joined:
    Oct 27, 2009
    Posts:
    73
    @LightingInABottle I think the comment above was that point lights themselves are casting their own shadow because lights in the scene see other lights as physical shadow casting geometry, and that's not good and should be fixed.

    Can we please have a status update on the following:

    Transparencies

    Directional lightmaps

    Lights occluding other lights

    Light probe baking

    Filtering

    Support for emissive scene materials

    Directional light support

    Thanks.
     
    buttmatrix likes this.
  38. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115
    Actually transparency is in the latest version along with rays not colliding with lights. 1.8.1 went live on the store today, I'm making some images to illustrate the new features now.

    I've only had 3 sales so far this month, so I can't make any promises that it will make sense for me to get to all of those features.
     
  39. NERVAGON

    NERVAGON

    Joined:
    Oct 27, 2009
    Posts:
    73
    Thank you. Your honesty regarding sales and motivation is appreciated, and it helped me to make some decisions regarding future projects.
     
  40. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115
    I hope this isn't meant to be passive aggressive. It would not be the first time that I've tried to set reasonable expectations while delivering features only to have it upset you. I'm glad you are enthusiastic about the tool, but I think it is reasonable to not commit to features like 'directional lightmaps' yet, since it hasn't been the focus from the beginning.
     
    Last edited: Mar 14, 2017
  41. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115
    Here is an example of two lights layered on top of each other while not occluding each other as well as the standard shader in cutout mode with the alpha cutoff respected. Here it creates a great lighting effect of with the warm small light giving a sharper shadow that has the large blue light bleeding into the edges.

     
    buttmatrix likes this.
  42. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115
    Here is a shot of the new 'Create Empty Lightmap' button

     
    buttmatrix likes this.
  43. NERVAGON

    NERVAGON

    Joined:
    Oct 27, 2009
    Posts:
    73
    ???
    You have never upset me. It seems like maybe you are the one who is upset? I was being genuine. I appreciated the heads-up. The features I listed were what I considered a realistic minimum for a feature complete baker. You responded by saying you aren't making much money, so it's not worth it for you. Which I genuinely appreciated. So, thanks, and I hope sales pick up for you. Good luck.
     
    buttmatrix likes this.
  44. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115
    Here is one more example of transparency, this time in 'fade' mode which allows gradient transparency instead of the binary visibility of cutout mode.



    My plan now is to look into a possible bug with textures being declared to the renderer, investigate rays going through multiple transparent objects, then work on an OSX port.
     
  45. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Would really appreciate directional light support
     
  46. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115
    I'm definitely still planning on doing that too. I think a lot of the issues people were having were with leaving the ray bias too small and equating the artifacts they saw in large scenes with the light type (which is a completely understandable misconception). Now the ray bias mult defaults to 32 instead of 1. It is something that people have asked for, so it is something I am planning on doing after a mac port, though I think the initial problems that people were having were due to ray bias.
     
  47. labCosium

    labCosium

    Joined:
    Jun 17, 2014
    Posts:
    11
    Hi ! Just buy your tool and would like to thank you to give us at least good way to replace awful Unity Enlighten integration :)

    Now I'm wondering if there is a possible way to bake AO using your tool ? Light rendering is very good, but we need AO baking here and every tools I tested under Unity are not so good...
     
  48. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115
    Hey labCosium, I'm really glad you like it. Ambient occlusion is just white light coming from everywhere evenly. You can actually get the same effect by putting 5 area lights in a box around whatever you want AO on.



    This might make a good button for the 'tools' section at the bottom. Once environment lights are built in it would only take one white sphere to accomplish the same thing. The important thing though is that ambient occlusion is one specific use of raytraced global illumination, so there are many good ways to do it, no need to wait for a specific tool.

    Let me know if this gives you what you need. Thanks!
     
    Last edited: Mar 25, 2017
    buttmatrix likes this.
  49. LightingInABottle

    LightingInABottle

    Joined:
    Nov 1, 2016
    Posts:
    115
    Two more images showing off recent refinements. The first shows lights with large areas not shadowing each other. The second image shows light passing through two separate planes with textured transparency.


     
    buttmatrix likes this.
  50. labCosium

    labCosium

    Joined:
    Jun 17, 2014
    Posts:
    11
    Thanks a lot for your quick reply ! In fact I've searched just after writing the message, and found same solution :) I just put 6 area lights because I need Light from complete surrounding "sphere".

    Now if possible I've some questions regarding main parameters :

    Regarding "Samples Per Pass", I've understood from the documentation and messages on this thread that it acts like a compromise between total time to compute and interactivity of current computation. What I don't understand is that it seems it also acts like a quality booster when I push the value :

    Here is a simple test using minimum samples per pass and after same test using maximum value :
    spp_0.jpg spp_1.jpg

    Every other parameters are the same between two pictures.

    I just wonder if it runs the way you think it or if there is a side effect somewhere... I'm probably wrong but in my mind it should have only influence on interactivity/render time ration, but not final quality.