Search Unity

What is FinalGather?

Discussion in 'Unity 5 Pre-order Beta' started by Devil_Inside, Feb 23, 2015.

  1. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,072
    Can someone please explain what is final gather and how it affects your visuals?
    I was playing around with a simple scene and decided to try final gather, but couldn't see any difference.
    Here's an animated example with the scene baked with and without final gather:
    FinalGatherTest.gif

    You can see the lightmaps change in the project panel, but there is absolutely no change in the scene view.
     
  2. Roni92

    Roni92

    Joined:
    Nov 29, 2013
    Posts:
    226
  3. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,072
  4. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,321
    Final Gather only affects Baked GI. I assume your emissive sphere is doing realtime emission and your light isn't baked?
     
  5. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,072
    Everything is baked.
    I'm attaching 2 more screenshots. There is a difference between them, but it's so tiny, that the only way to notice it, is to cycle between the 2 screenshots. Maybe that's how it's supposed to be?
    FG_Off.jpg
    FG_On.jpg
     
  6. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,321
    The difference will be more noticeable when you have a lot of indirect light bounces and low resolution.

    FinalGather_2015-02-23_16-50-10.png NoFinalGather_2015-02-23_16-50-22.png
     
  7. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,072
    I've tried a similar setup with some cylinders, to see if it makes any difference:
    FG_Off2.jpg
    FG_On2.jpg
    The only thing I see, is a barely noticeable color bleed on the floor between the cylinders, and the cylinders themselves being a bit brighter. Nothing to the extent of what you've got on your screenshots. Your second screenshot doesn't seem to have any baked lighting.
     
  8. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,018
    One way to get all of this working is using baked emissive, and a light set to realtime for now.

    And @KEngelstoft is right. You need to increase the baked resolution, 40 is too low for a room that large.
     
  9. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,072
    40 is the default resolution. What kind of room size was it intended for?
     
  10. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,072
    Ok, I'm an idiot. I was setting emission to "baked" on the material that wasn't used in the scene.
    I've changed it on the spheres, and got that noisy pattern on the floor, which leads me to believe that final gather is working.
    Still, is it supposed to only work with emissive materials, and not lights?
    And what resolution should I use to get rid of the noisy pattern?
     
  11. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,180
    Lights use final gather too.
     
    shkar-noori likes this.
  12. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,072
    They probably do, but I was unable to see any noticeable effect.
    I lowered down the ray count a bit for a quick test and baked 5 examples.
    First 2 are baked lights with hard shadows. Didn't notice any noticeable improvement with final gather.
    Second pair of screenshots are baked lights with no shadows. For these, I'd hope final gather would generate some shadows, but the 2 screenshots are basically identical, except the noise. If I increase the ray count, the noise goes away, and you can't hardly see any difference at all.
    The last screenshot is where I replaced all the lights with emissive spheres. This time final gather is much more noisy but you can clearly see that it generates contact shadows.
    FG0.jpg
    FG1.jpg
    FG2.jpg
    FG3.jpg
    FG5.jpg
     
  13. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,321
    My scene had the same setup as your 4th screenshot and 4K ray count. You have to increase ray count a lot to get completely smooth results with FG. This is something that can be improved by using importance sampling when casting the rays and something we hope to add later in 5.X.
     
    KRGraphics likes this.
  14. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,018
    I was gonna ask about that. I usually use a high ray count and an fg ray count half the value of the baked rays. The results will take a while but the results will speak for itself.

    Will you add a feature for colour bleed range? Would be cool if the colours could bleed stronger
     
    Last edited: Feb 24, 2015
  15. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,072
    Yeah, I tried the setup from the 4th screenshot (lights with no shadows) with a higher ray count (8K). That got rid of the noise, but there were no shadows. I've replaced the lights with emissive spheres, and I've got nice contact shadows.
    So, while it works fine with emissive materials, there's something going on with lights.
    FG6.jpg
    FG7.jpg
     
  16. DanSuperGP

    DanSuperGP

    Joined:
    Apr 7, 2013
    Posts:
    408
    And there's definitely still the question of what's going on with the lit up ceiling on the other side of the room.
     
  17. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,072
    There's that cube in the corner. I think it's the light that reflects off that cube that brightens up the ceiling in the corner. Why it's so bright? I think it might be related to the issue I mention here: http://forum.unity3d.com/threads/em...n-with-a-specific-lightmap-parameters.298991/
     
  18. DanSuperGP

    DanSuperGP

    Joined:
    Apr 7, 2013
    Posts:
    408
    Is the cube in the corner emissive?

    I was thinking it might be bounce off the light coming in from the doorway
     
  19. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,072
    No, the cube is not emissive.
     
  20. DanSuperGP

    DanSuperGP

    Joined:
    Apr 7, 2013
    Posts:
    408
    So, as an experiment... try rotating your directional light around the y axis so that it's facing a different direction.
     
  21. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,072
    Here's the same scene with directional light facing the opposite direction:
    FG8.jpg
     
  22. DanSuperGP

    DanSuperGP

    Joined:
    Apr 7, 2013
    Posts:
    408
    Ok, that rules out bounced light from the doorway then.
     
  23. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,321
    It is because FG doesn't affect the direct lighting, only the bounce lighting. Light bounced from a light source will also get handled by FG, just not the direct part.
     
    Devil_Inside likes this.
  24. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,321
    You can add a meta pass to your shader enhance or change the way Albedo is calculated. Have a look in the scene view called Global Illumination -> Albedo to see what is fed into Enlighten.
    You can for instance write a meta pass that uses vertex colors for emission or albedo, or have a green emission or red albedo, even if the shader is just a grey rock shader. This way you can change bounce appearance without affecting the shader output in ordinary rendering. There is also a global Bounce Boost slider that increase albedo output, but be careful that you don't saturate the colors. You didn't have this level of control with Beast. Have a look at the attached shader for an example of a simple shader that decouples GI albedo from the regular material appearance.
     

    Attached Files:

    KRGraphics likes this.
  25. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,072
    So the light from emissive materials is considered to be bounced light?
     
  26. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,018
    That view is currently broken in RC3... I would have to turn off HDR.

    I will take a look at this... :) I actually like the near complete control I get when I use Enlighten...
     
  27. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,018
    I usually classify emissive lighting as an area light.. so yes. :)
     
  28. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,072
    @KEngelstoft mentioned in this thread that GI shadowing for point and spot lights will not be in 5.0
    Another noob question from me, what is GI shadowing? Is it somehow related to the issues I'm seeing here? (objects not casting shadows when baking a lightmap and a baked light doesn't have shadows enabled)
     
  29. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    657
    As I understand it, the lack of GI shadowing for point and spot lights means that the bounced light from those types of light goes straight through walls.
     
    Devil_Inside likes this.
  30. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,072
    Ok. I'm starting to understand now :)
    For direct-light shadowing you set light shadows to hard or soft, and for indirect-light shadowing, it needs to be supported by Enlighten/GI solution.
     
  31. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,321
    No. It is only visibility for indirect lighting from realtime GI that is affected by this missing in 5.0, not baked GI.
     
    Devil_Inside likes this.
  32. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,072
    Thanks everyone for spending your time in this thread! You really helped me better understand all this concepts!
     
unityunity