Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Progressive Lightmapper Direct vs Indirect samples?

Discussion in 'Global Illumination' started by IgorAherne, Nov 2, 2017.

  1. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    339
    Hey,

    Question 1:
    How do the "direct samples" and "indirect samples" differ? (progressive lightmapper)

    Looking at the docs, it's never mentioned, the only thing that's explained are "samples"
    • Samples - The amount of samples (paths) shot from each texel. For some scenes, especially outdoor scenes, 100 samples may be enough. For indoor scenes with emissive geometry more will be needed.
    Ok, so we are shooting that many rays from each texel, to search for colors all around our point.
    However, why the amount of iluminated dots around the blue sphere stays the same if I crank up Direct samples from 0 to 1000?

    But, if I change indirect samples from 10 to 1000, only then does it increase the number of texels which had enough sampling rays to "notice" a glowing sphere nearby.
    samples.JPG
    Here you can observe how the points notice the sphere, where red arrows are one of such a ray-bouquet shot from 3 texels.

    Why direct samples didn't affect it? To me changing direct samples doesn't affect anything :/
    One weird thing is that Indirect samples cannot go below 10, but direct samples can be negative
    (Unity 2017.2f03)

    Question 2:
    Also, regarding Area Lights, - does it shoot photons out, like MentalRay? Or is it up to the objects to find such an area light, through these ray-bundles as mentioned in this post? That process is also called Final Gather

    I have a feeling that area lights aren't shooting-out photons, because "Direct Light Quality" is grayed out, and isn't modifiable in Lightmap settigns asset when using Progressive Lightmapper. It's only tweakable when working with Enlighten

    Thank you!

    lightmap settings.JPG
     
    Last edited: Nov 2, 2017
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    5,576
    The only things that emit "direct" light are the lights. Emissive surfaces (like your sphere in your example) emit indirect light.
    Neither, it uses path tracing.
     
  3. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    339
    Did two tests to confirm that
    - 2 bounces results in one extra light transfer originating from emissive surface,
    - 3 bounces results in two extra light transfers originating from emissive surface.

    Indeed, it seems that in order to illuminate itself, a texel has to find an emissive material nearby, so emissive surfaces are processed as an indirect light emitters. So they rely on Final Gather
    b2.JPG
    3 b.JPG


    As I understand, path tracing is about selecting a point, then sending several wondering-rays which bounce through surfaces until they encounter a light source. If, yes, then we light the point with colors of all intermediate surfaces, otherwise we leave our point as is. I in our case, path tracing would be the final gather (correct me if I am wrong) - since we are sending querying rays from the surface, not from every pixel on the screen.

    So, in other words - in Progressive Lightmapper, will area lights have same behavior as a spotlight or point light?
    Why in that case neither Direct nor Indirect Samples doesn't affect the area lights?
     
    Last edited: Nov 2, 2017
  4. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    339
    I did a similar test with area light, and it's not similar to the emissive surface - for these area lights the red dots apear even with 2 bounces. So it indeed must be using a form of path tracing, like photon mapping

    It's quite uncomfortable that there is no way to affect area light's quality when using Progressive lightmapper (Area lights have the best looking result), and Enlighten just takes ages to complete
     
    Last edited: Nov 2, 2017
  5. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    5,576
    I haven't tested it recently, but area lights do use the direct light samples, so bump up the direct samples by a lot and the results should improve.

    I'm not sure, but I don't think it works like that. I believe it's shooting rays from light sources and does not gather them.

    (in the end, as far as we are concerned, it doesn't matter)
     
  6. henrivivier

    henrivivier

    Joined:
    Apr 12, 2017
    Posts:
    2
    Im struggling to get rid of the noise on very smooth surface when using Area light... Anyone found a solution to get rid of splotchiness ? I tried cranking up the direct and indirect samples (2000/1000) but its still not perfect.
     
  7. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    339
    I can't remember it fully, but I think you can create a lighmap settings asset from Lighting window, then adjust settings from there. Also, you need to select such a created asset from the LIghting window's dropdown.

    That should affect area lights starting from 2018.1 for 2017 they kept it fixed and low.

    I really wanted to use area lights everywhere, even for ouside lighting because it looks so good and there is no direct light that wouldn't affect the whole level at once.

    But large area lights indeed looked ugly :(

    F
     
  8. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    339
    As a very last resort, smooth out by hand in photoshop xD