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. Dismiss Notice

Fake Realtime Global Illumination

Discussion in 'Works In Progress - Archive' started by Gistix, Apr 6, 2014.

  1. Gistix

    Gistix

    Joined:
    Jul 21, 2013
    Posts:
    29
    Hello guys, yesterday I had the idea to create a fake GI (Radiosity), calculating a grid, and casting rays from it, it is really simple, it works by getting the ray hit pixel color, and applying to a Point Light, which is positioned at the ray hit position, you can enable or disable shadows for the Rad Lights, and also "bake" the lights positions to consume less resources, take a look.

    Disabled
    $GIDisabled.png

    No Shadows
    $GINoShadow.png

    Full(With Shadows)
    $GIFull.png

    I'll just revise the script to optimize, and then I'll release it in here.

    For the future:
    *Add support for Spot and Point lights
    *Add saturation control
    *Add light bounces
    *Search for a faster way to do shadows
     
    Last edited: Apr 7, 2014
    KWaldt and Eric2241 like this.
  2. IanStanbridge

    IanStanbridge

    Joined:
    Aug 26, 2013
    Posts:
    334
    Hi I don't think you added the attachments correctly as they are showing invalid for me.
     
  3. Gistix

    Gistix

    Joined:
    Jul 21, 2013
    Posts:
    29
    Fixed, thanks!

    New pic:
     
    Last edited: Apr 7, 2014
  4. IanStanbridge

    IanStanbridge

    Joined:
    Aug 26, 2013
    Posts:
    334
    Looks great. Out of interest what is the performance difference between those 3 pics. What impact on performance is there using the shadows ? Also is the idea going to be that it is just a script that you can add to a camera ? It would be great if it was easy to just enable or disable the effect based on the performance of the pc that it was running on so that it would be disabled if the frame rate dropped too much.
     
  5. Gistix

    Gistix

    Joined:
    Jul 21, 2013
    Posts:
    29
    Disabled I got 50~60 FPS, Without shadows I got 30~40 FPS, Shadows on I got 20~30 FPS, I still got a lot to do and optimize, but it is a single script that you attach to your Direct Lights, I'll work on it for Point and Spot lights, it's fully customizable, from shadows to intensity, and you can also change the grid scale and the ammount of rays to be casted (and lights to be created).
     
  6. 0tacun

    0tacun

    Joined:
    Jun 23, 2013
    Posts:
    245
    You started yesterday? Yesterday I thought of how to discard pixels in a checkerboard style! :D looks amazing, do you mean with the third picture that the shadow was also calculated with your GI script?
     
  7. Gistix

    Gistix

    Joined:
    Jul 21, 2013
    Posts:
    29
    Yeah, Like dissolving? It must be looking awesome! well, the script only creates lights and then it change the position and the colors, all the shadows are Unity Shadows, everything on these pics are done realtime.

    Added Light Bounces:
    $RadiosityBounce00.png
    $RadiosityBounce01.png
    $RadiosityBounce02.png

    With Shadows:
    $RadiosityBounce02_Shadows.png
     
    Last edited: Apr 7, 2014
    Eric2241 likes this.
  8. Glader

    Glader

    Joined:
    Aug 19, 2013
    Posts:
    449
    This is amazing!
     
  9. sandboxgod

    sandboxgod

    Joined:
    Sep 27, 2013
    Posts:
    366
    Interesting...
     
  10. 0tacun

    0tacun

    Joined:
    Jun 23, 2013
    Posts:
    245
    Well not even close to that :) Thank you for the info. Are you getting those fps numbers in forward or deferred rendering?
     
  11. nipoco

    nipoco

    Joined:
    Sep 1, 2011
    Posts:
    2,008
    Nice.

    I wondering how this compares to the upcoming Enlighten?
     
  12. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    I'm pretty sure if you check the asset store forum there is already someone far along in development of a system basically the same as this, firing rays to find sample points and then adding extra light sources. Your example scenes are almost identical.
     
  13. SiegfriedCroes

    SiegfriedCroes

    Joined:
    Oct 19, 2013
    Posts:
    569
  14. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,783
    Except if the OP tech based on reflective shadow mapping then it would be different
     
  15. CaseJnr

    CaseJnr

    Joined:
    May 14, 2014
    Posts:
    43
    Was this script released? Where can I find it?
     
  16. Deleted User

    Deleted User

    Guest

    i like it for my last walkable room be nice i have so tool :D
     
  17. JecoGames

    JecoGames

    Joined:
    Jan 10, 2013
    Posts:
    135
    Can you please post this script!
     
  18. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    12,842
    Indeed :), i just released the demo of the new version that has 2ond bounces too

    GI Proxy is the asset

    The whole idea of adding lights is simple, but tweaking it so they appear smoothly and look like GI than blinking lights is a lot harder :)

    Also you cant add a huge number of lights, so there are many other methods needed to handle their creation properly.