Announcement

Collapse
No announcement yet.

Lets make Lightmass EPIC (and understandable)

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Lets make Lightmass EPIC (and understandable)

    I am overwhelmed by the response from Lightmass developer himself - @DanielW. I want to ask like million things right now, but certainly that's not possible. So I quickly created this Unreal project to ask for the solution to some of the basic/fundamental problem I (we all) are encountering during self learning of Lightmass.

    In Vray or Corona we can visualize/see the actual samples taken into consideration for final calculation, which in turn gives us a chance to increase samples, size or filtering to remove blotches and noise from the GI. Also it is well documented how Light cache and Irradiance Map is working in Vray and we get individual settings for subdivisions and sample number/size (We have precise control over what is going on under the hood).

    Unreal Engine's lightmass is amazing when it comes to ease of use and speed, but critically lacks when it comes to provide precise control over GI calculations and that too with vague explanations without any proper example.

    It would be amazing if we bring some the Values/settings in UI of Engine dealing with - Photons (Direct, Indirect and Irradiance). We need documentation about how the Photon mapping is working inside the Lightmass, covering all the relevant values which are necessary to produce clean GI with clear-cut contact shadows. There are too many values to understand from SceneExport.h and that too without backing of proper visual examples(It's kind of impossible to understand these values without visual examples in engine)

    Why we Architecture Visualization artist going for .1 or .2 values in Static Lighting Level scale? - To grasp all the intricate details in every corner of the space without loosing any contact shadows (Wide open diffused white walls are always difficult to deal). All Unreal Engine Architecture work is in direct competition with Vray and Corona, giving ultimate control for GI will certainly level the ground for all.

    I believe all the settings are there to produce stunning results from Lightmass (Many artists have already proved it). But unfortunately that involves tweaking in BaseLightmass.ini, which make things somewhat hazy and unpredictable (Don't know what values are doing exactly).

    Here are the Visual Example of the problems faced by almost everybody during lightmass calculation. I tried few different combinations of lighting. Whole scene is being uploaded for sharing, will give the link ASAP.

    Level one is only lit by Skylight with HDRI


    These are the Lightmass settings -




    Results











    All walls with Floor and Roof have 1024 Resolution. As you can see the quality is unacceptable, lots of blotches in dark areas. Areas coming in direct contact with skylight are well lit without bugs, all the problem is in dark areas where direct skylight is not hitting.



    In second level I have put the stationary spot lights in corner to remove the splotches (hoping for the best). Lightmass world settings are same as above.












    Using Spotlights with .1 value in Static Lighting Level scale almost always gives this infamous Light Leaks without improving the secne as much, rendering scene unusable. With 3 folds increase in rendering time.

    Long build times are not so much of a problem if in the end we know what we are going to get (Predictable results).

    Whole scene images -





    @DaneilW -

    Kindly Let us know -

    1. How to remove the splotches in the area where there is no skylight hitting directly (Areas far from windows). As you can see in the above images there are so many splotches in gallery, despite having Indirect Lighting quality to = 10 and static Lighting Level scale = .1

    2. Shadows become somewhat messy after a certain distance. How to make area shadows more clear and smooth.

    3. Whenever we put spotlights to remove dark areas, it almost always gives the annoying problem of light leaks. Clearly evident in the above images.

    4. What are Direct Photons, Indirect Photons and Irradiance Photons in relation with Lightmass and there respective uses in GI solver.


    Regards

    Unreal Engine Architectural Visualization Community
    Attached Files
    Raghu
    http://rag3dviz.com
    HDRI Lighting Tutorial
    Basic UVW Workflow Tutorial

    #2
    all the right questions. I hope we'll receive answers and bring this whole UE4 archviz to the next level.

    Comment


      #3
      How did you lit the scene only with skylight? I am trying to use HDRI_Epic_Courtyard to light my scene with (instead of directional light) and it doesn't work.
      Portfolio

      Comment


        #4
        I'm wondering if settings the Indirect Lighting Bounces to the max (100) instead of 50 will have any effect on the splotches on the walls.
        I always use a value of 100 which works well if you're just lighting one single room, but I guess I never tried it in a scene where the light has to bounce around multiple corners and hallways.

        As for the light leaks; I think you will be able to get rid of those when you intersect your walls with the floor and ceiling.
        My Porfolio

        Comment


          #5
          It's my understanding that skylight photons only bounce 2 times, which is why they're almost never sufficient to light an interior by themselves. In my own stuff, I've augmented the skylight with additional exterior (point) lights with low direct intensities and high indirect intensities that fill in the gaps where the skylight stops bouncing. This leads to very long build times, and I still have some of the splotchy light leaks like in this picture: http://rag3dviz.com/wp-content/uploa...potlights2.jpg

          EDIT: I've also started having a problem (on multiple computers, in different levels) where building the lighting hangs on 0%. Canceling it and starting it again without changing anything often works, but it seems totally random. Restarting UE4 and my computer has no more effect than simply canceling and re-trying.
          Last edited by Wilkes; 10-23-2015, 11:54 AM.

          Comment


            #6
            You shouldn't change the lighting scale. Some of the settings you want are in the Lightmass.ini file, that allows you to adjust photons and stuff like that--that's what Koola was adjusting for his stuff, though he said it wasn't really necessary.

            What can help, is increasing the lighting quality while decreasing the smoothing. It increases build times though.

            Comment


              #7
              Great specific breakdown Raghu, that helps me identify issues tremendously. There are clearly some bugs causing splotchiness under those quality settings. Hook me up with the download for the scene, it will take some detailed investigation.

              Comment


                #8
                In the meantime, here's an overview of the methods used along with their pitfalls. I tried to inline the relevant BaseLightmass.ini settings. First, there are two completely separate paths for punctual lights (directional, spot, point) than for sky lights.

                Lightmass is heavily optimized around solving indirect lighting from punctual lights with high quality. In particular, the case where you have bright sunlight coming in a small window and hitting the wall/floor, lighting up the whole room, is what I would consider the primary use case. Lighting with sky lights / HDRI is a much more recent implementation and honestly it's not very high quality.

                Punctual light method:

                The short summary is that Final gathering is used to solve the first lighting bounce, and photons are used for bounces after that along with guiding the final gather.

                1) Many photons are emitted from the light and deposited on the scene as directly visible (direct photons). We bounce these once and record any direct photon paths that resulted in a bounced photon being deposited. This identifies small (but critical) light entrances like windows. DirectPhotonDensity controls how many photons are emitted in this stage, and IndirectPhotonPathDensity controls how many paths are recorded (how accurately we find small windows).
                2) Many more photons are emitted from the light, along the direct photon paths. These are bounced for as many times as you requested NumIndirectLightingBounces. Each bounce has a much smaller number of photons successfully bouncing so more bounces after 2 has only a small impact on build times. IndirectPhotonDensity + IndirectIrradiancePhotonDensity control how many photons are emitted to represent multi-bounce lighting.

                Now that the photons are ready for the entire scene we can start operating on each lightmap texel.

                3) Direct shadowing is computed for static and stationary lights. For static lights which use area shadows, NumShadowRays and NumPenumbraShadowRays control the quality of the penumbra, more samples are needed to support very large, smooth penumbras.
                4) We check to see if this texel is covered by other irradiance computations (steps 5-7). If there is, we reuse these nearby irradiance samples through interpolation. If not, we continue to steps 5-7. This is called Irradiance caching. Too much interpolation causes indirect shadows to be lost. The amount of reuse is controlled by RecordRadiusScale, PointBehindRecordMaxAngle, InterpolationMaxAngle. During the interpolation, we can gather even more nearby irradiance samples to further smooth the lighting.
                5) Nearby indirect photons are gathered around the lightmap texel. These tell us where most of the bright lighting is coming from, eg the small bright spot that lights up the entire room.
                6) We begin the final gather. Rays are traced out in all directions for the hemisphere of the texel. At the end of the ray we either hit some geometry, where we gather the lighting from photons at that point, or we miss geometry and hit the sky, where we evaluate the sky lighting. NumHemisphereSamples controls how many rays there are in this first refinement step.
                7) We do multiple iterations of refining the final gather. Each sector of the hemisphere is subdivided and we trace more rays to discover incoming lighting. We subdivide deeply around incoming indirect photons to make sure we resolve the small bright spot on the ground lighting the whole room. This is a form of importance sampling, also called importance driven final gathering. We also subdivide anytime there are significant differences between neighbors to reduce noise, this is called adaptive sampling. NumAdaptiveRefinementLevels controls how many refinement levels there are, AdaptiveBrightnessThreshold controls how big of a neighbor difference there must be to refine a sector.

                As to the Lightmass WorldSettings options, IndirectLightingSmoothness operates on the settings in step 4), the amount of irradiance cache smoothing.
                IndirectLightingQuality increases the number of samples and depth of refinement in steps 5-7, the final gathering.

                Sky light method (assuming static skylight, stationary is a bit different):

                1) The sky light HDR texture is exported to Lightmass as an 3 band spherical harmonic, which you can think of as an extremely low resolution cubemap (2x2 on each face approx). So if you have a very bright spot in the sky cubemap it will be spread out over a large region. This is basically prefiltering to avoid noise.
                2) We do a mini final gather at each lightmap texel and compute sky lighting with a very low number of rays. This is cached on the surface and will become the first bounce of skylight GI once the final gather accesses it.
                3) During the final gather, any rays that hit the scene look up the cached sky direct lighting from step 2), which now becomes first bounce sky lighting. Any rays that miss the scene and hit the background lookup from the sky SH, this is sky direct lighting. We refine the final gather based on brightness differences between sectors of the hemisphere, but no importance sampling is done because we don't have any photons from the sky.

                So now you can see why static sky lights have limited quality and only support one indirect lighting bounce. This is something we could improve, but it's a lot of work and complexity. Specifically, we should actually export a cubemap to Lightmass, and do importance sampling of the cubemap's contents (trace more rays to the brighter texels).
                Last edited by DanielW; 10-23-2015, 05:04 PM.

                Comment


                  #9
                  This is pretty much Chinese to my hear but I'm happy to see devs interested in improving lightmass for arch-viz users!

                  You may have a potentially HUGE market in sight because everybody in arch-viz communities are talking about real-time/Unreal. I think eventually we all want to go real-time!

                  Comment


                    #10
                    Daniel:

                    This is where I would like to get to in Unreal - not sure it's possible? It's just an HDRI and a Sun in Blender/Cycles render engine. There is some post processing in Photoshop.

                    Click image for larger version

Name:	Chandler-deck-1000x.jpg
Views:	1
Size:	113.9 KB
ID:	1091766

                    Comment


                      #11
                      What kind of method cycles use for G.I? path tracing?

                      Comment


                        #12
                        Originally posted by heartlessphil View Post
                        What kind of method cycles use for G.I? path tracing?
                        http://wiki.blender.org/index.php/De...es/2.61/Cycles

                        Comment


                          #13
                          Heh, maybe I got too technical.

                          This is where I would like to get to in Unreal - not sure it's possible? It's just an HDRI and a Sun in Blender/Cycles render engine.
                          Short answer - not without some significant work on our part. Pure HDRI quality is lacking. But I hear you guys loud and clear, that's how you want to light (as opposed to directional or spot lights).

                          Comment


                            #14
                            while we're talking about lightmass...is there a way (or is it planned, even possible) to calculate lighting for just selected objects? for example, if we add single object/move or add a light, the engine tells us how many objects need their lightmaps calculated. if the engine can tell that, why not enable lighmaps calculations only for affected geometry? it would speed up things even further instead of waiting another hour and a half for light calculation to finish for the whole level when only one object was added...

                            Comment


                              #15
                              Originally posted by DanielW View Post
                              In the meantime, here's an overview of the methods used along with their pitfalls. I tried to inline the relevant BaseLightmass.ini settings. First, there are two completely separate paths for punctual lights (directional, spot, point) than for sky lights.

                              Lightmass is heavily optimized around solving indirect lighting from punctual lights with high quality. In particular, the case where you have bright sunlight coming in a small window and hitting the wall/floor, lighting up the whole room, is what I would consider the primary use case. Lighting with sky lights / HDRI is a much more recent implementation and honestly it's not very high quality.

                              Punctual light method:

                              The short summary is that Final gathering is used to solve the first lighting bounce, and photons are used for bounces after that along with guiding the final gather.

                              1) Many photons are emitted from the light and deposited on the scene as directly visible (direct photons). We bounce these once and record any direct photon paths that resulted in a bounced photon being deposited. This identifies small (but critical) light entrances like windows. DirectPhotonDensity controls how many photons are emitted in this stage, and IndirectPhotonPathDensity controls how many paths are recorded (how accurately we find small windows).
                              2) Many more photons are emitted from the light, along the direct photon paths. These are bounced for as many times as you requested NumIndirectLightingBounces. Each bounce has a much smaller number of photons successfully bouncing so more bounces after 2 has only a small impact on build times. IndirectPhotonDensity + IndirectIrradiancePhotonDensity control how many photons are emitted to represent multi-bounce lighting.

                              Now that the photons are ready for the entire scene we can start operating on each lightmap texel.

                              3) Direct shadowing is computed for static and stationary lights. For static lights which use area shadows, NumShadowRays and NumPenumbraShadowRays control the quality of the penumbra, more samples are needed to support very large, smooth penumbras.
                              4) We check to see if this texel is covered by other irradiance computations (steps 5-7). If there is, we reuse these nearby irradiance samples through interpolation. If not, we continue to steps 5-7. This is called Irradiance caching. Too much interpolation causes indirect shadows to be lost. The amount of reuse is controlled by RecordRadiusScale, PointBehindRecordMaxAngle, InterpolationMaxAngle. During the interpolation, we can gather even more nearby irradiance samples to further smooth the lighting.
                              5) Nearby indirect photons are gathered around the lightmap texel. These tell us where most of the bright lighting is coming from, eg the small bright spot that lights up the entire room.
                              6) We begin the final gather. Rays are traced out in all directions for the hemisphere of the texel. At the end of the ray we either hit some geometry, where we gather the lighting from photons at that point, or we miss geometry and hit the sky, where we evaluate the sky lighting. NumHemisphereSamples controls how many rays there are in this first refinement step.
                              7) We do multiple iterations of refining the final gather. Each sector of the hemisphere is subdivided and we trace more rays to discover incoming lighting. We subdivide deeply around incoming indirect photons to make sure we resolve the small bright spot on the ground lighting the whole room. This is a form of importance sampling, also called importance driven final gathering. We also subdivide anytime there are significant differences between neighbors to reduce noise, this is called adaptive sampling. NumAdaptiveRefinementLevels controls how many refinement levels there are, AdaptiveBrightnessThreshold controls how big of a neighbor difference there must be to refine a sector.

                              As to the Lightmass WorldSettings options, IndirectLightingSmoothness operates on the settings in step 4), the amount of irradiance cache smoothing.
                              IndirectLightingQuality increases the number of samples and depth of refinement in steps 5-7, the final gathering.

                              Sky light method (assuming static skylight, stationary is a bit different):

                              1) The sky light HDR texture is exported to Lightmass as an 3 band spherical harmonic, which you can think of as an extremely low resolution cubemap (2x2 on each face approx). So if you have a very bright spot in the sky cubemap it will be spread out over a large region. This is basically prefiltering to avoid noise.
                              2) We do a mini final gather at each lightmap texel and compute sky lighting with a very low number of rays. This is cached on the surface and will become the first bounce of skylight GI once the final gather accesses it.
                              3) During the final gather, any rays that hit the scene look up the cached sky direct lighting from step 2), which now becomes first bounce sky lighting. Any rays that miss the scene and hit the background lookup from the sky SH, this is sky direct lighting. We refine the final gather based on brightness differences between sectors of the hemisphere, but no importance sampling is done because we don't have any photons from the sky.

                              So now you can see why static sky lights have limited quality and only support one indirect lighting bounce. This is something we could improve, but it's a lot of work and complexity. Specifically, we should actually export a cubemap to Lightmass, and do importance sampling of the cubemap's contents (trace more rays to the brighter texels).
                              These explanations are spot on (Made so many things easy and this is the minimum information required to understand lightmass). Till you guys made HDRI Lighting awesome in unreal engine, kindly let us know how to resolve some common issues which come when we simulate HDRI lighting with added support of Punctual lights.

                              Link to download above scene file - https://www.dropbox.com/s/kjp8sow7do...tmass.rar?dl=0
                              Last edited by Raghu; 10-24-2015, 04:22 AM.
                              Raghu
                              http://rag3dviz.com
                              HDRI Lighting Tutorial
                              Basic UVW Workflow Tutorial

                              Comment

                              Working...
                              X