Search Unity

Real-time global illumination?

Discussion in 'Made With Unity' started by Kuba, Jul 31, 2009.

  1. Kuba

    Kuba

    Moderator

    Joined:
    Jan 13, 2009
    Posts:
    416
    If you were wondering how far you can push Unity grapics-wise, here's the answer:





    Real-time lighting, no lightmaps. Dynamic light and geometry.
     
  2. robert

    robert

    Moderator

    Joined:
    Dec 21, 2008
    Posts:
    265
    Hi *,

    This is our master thesis on Real-Time Rendering and Interactive Configuration of Apartments, on which we worked together with Kuba.

    In short: real-time global illumination via instant radiosity and deferred lighting.

    From the Abstract:
    __________________________________
    We present a method for high quality, real-time rendering of apartment interiors, illuminated with dynamic light and under the conditions of changing geometry. The complete lighting solution is composed of a number of techniques (area lights, indirect illumination, direct highlight) working in conjunction with a global illumination algorithm based on virtual point lights. Rendering of hundreds of lights at real-time frame rates is enabled by a deferred lighting pipeline, decoupling scene and lighting complexity.

    We demonstrate, that the described solution allows the user to interactively modify geometry (customisation of the apartment's layout) and lights (e.g. time of day modification). We also suggest an acceptable degradation method enabling the same lighting quality on slower machines.
    __________________________________

    The prototype has been developed in Unity of course, and you're welcome to try it out (it has quite high hardware requirements, though).

    The thesis itself has been written in a form of a short article – a recommended read if you're interested how the technique works.

    (Note: the prototype has been developed in an yet unreleased Unity version 2.6. This is why we're not posting the project files yet, nor the web player build, which is actually our target platform.)

    All the resources here:
    robert.cupisz.eu
    kuba.cupisz.eu
     
  3. magwo

    magwo

    Joined:
    May 20, 2009
    Posts:
    402
    Not bad! Although I get sad by these kind of things when I realize they're not feasible in games yet. :)
     
  4. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    who said you can't use it in games. how about "spot the error in the picture" games? ;)
     
  5. johan

    johan

    Joined:
    May 15, 2009
    Posts:
    199
    Some antialiasing would be nice.
     
  6. defmech

    defmech

    Joined:
    Feb 24, 2007
    Posts:
    506
    This kinda stuff works just fine for games. Several important studios have licensed both Lightsprint and Enlighten. Glad to see work being done on this. I was going down that road last year until our funding went poof.
     
  7. lues de fabulam

    lues de fabulam

    Joined:
    May 18, 2009
    Posts:
    41
    Nice. I don't have any technical knowledge on what exactly this method is supposed to achieve; reality, feasibility etc, but the back corridor and what looks to be the closet are way too dark in such a short range.

    Does it run any better for Unity 2.6, or will you be improving it significantly? My GPU (which, for a crude comparison, handles Crysis fine at mid settings; perfectly playable) just produced tearing and artifacts due to overheating :p
     
  8. jtbentley

    jtbentley

    Joined:
    Jun 30, 2009
    Posts:
    1,397
    Exposure settings come to mind to really do it properly. But the lighting I see there would be more than sufficient if you chose a slightly grungier enviroment (make those walls brick or rock, make the ground concrete).

    The easiest way to hide cheap lighting is with additional edge detail, makes it a lot more difficult for the brain to pick flaws in lighting. So straight away, if you made the floor into tiles, it would instantly be more believable, etc :p
     
  9. ProtonOne

    ProtonOne

    Joined:
    Mar 8, 2008
    Posts:
    406
    Wow that is pretty amazing. Really good quality.

    It was really cool to move the walls around and see how everything adjusted. It wasn't real-time enough for a FPS or anything on my MBP, but it sure shows potential.
     
  10. janne404

    janne404

    Joined:
    Jul 26, 2009
    Posts:
    17
    That's amazing stuff! Says one who's used to bake global illumination into textures with mental ray and it can take hours to render. Global illumination in realtime that's the future someday!
     
  11. Kuba

    Kuba

    Moderator

    Joined:
    Jan 13, 2009
    Posts:
    416
    I'd say reality and feasibility on the hardware from 1,5 years back.
    Anyways, I think you're not taking into consideration the fact, that your brain is cheating you a lot when seeing such a setting. This result is close to what you would get when running around the place with a camera set to a fixed exposure. Of course eye accommodation technique could be future work.

    No and maybe. When you run the standalone, you're technically running 2.6. As for the improvements - let's first take some holidays and think afterwards.

    Sure, cause rock and concrete are just the default materials in one's apartment. On a more serious note though, we have chosen to present the apartment as it was shortly after it has been built. Walls are covered with smooth plaster to show what is the real quality of lighting that can be achieved. Using high frequency textures that would cover any flaws in the lighting would just be cheating.

    That's the most expensive cheap lighting I have ever seen! :wink:
     
  12. jtbentley

    jtbentley

    Joined:
    Jun 30, 2009
    Posts:
    1,397
    Its nowhere near the most expensive lighting you've ever seen.. It's the most expensive realtime lighting you've ever seen :)

    Having pipelined architectural previs into both Source and Unreal Engine, I totally appreciate real time application of globals... Since with Source you hit 'build' and pray it does a decent job with its 'dumb' rays, and Unreal is a baking nightmare :)

    Runners on the ceiling and floor around those walls would totally help 'ground' it all (perhaps a necessary evil in the absence of ambient occlusion).

    So, now the question everyone wants.. can you do realtime caustics? :p

    (I'm aware there is nothing physically accurate about AO but it usually is extremely helpful in adding that extra 5% of realism).
     
  13. yahadi

    yahadi

    Joined:
    Jun 28, 2009
    Posts:
    36
    Great work guys,

    - Is there anything preventing this from being applicable to any interior scene (An Aztec temple perhaps?) and with animated characters.

    - Can you kindly post an executable file with anti-aliasing and the ability to launch full screen at any selected resolution (Like normal unity projects)
     
  14. robert

    robert

    Moderator

    Joined:
    Dec 21, 2008
    Posts:
    265
    Thanks for all your comments!

    I'm running it on a unibody MBP, and it's quite smooth (but nowhere near fast enough for an FPS, of course). Some detailed performance timings are discussed in the article, but they're for a desktop geforce 8800. I might post some timings for a mobile geforce 9600M later on.

    Well, lightmap baking within Unity is coming sooner or later, so stay tuned ;)

    We were thinking about adding SSAO to the effect, but there's no point. Plain SSAO (or any other AO) just looks like dirt, as it does not respond to lighting changes (we comment on that in the article). It only looks plausible, if you're rendering a sewer control room ;>

    SSDO on the other hand might positively contribute to the final effect, but it probably wouldn't be all that visible.

    Sure. There are some really clever image-space techniques fast enough to be suitable for real-time apps and could be integrated into our pipeline. If you're interested, read on: Caustics Mapping

    There's nothing physically accurate about any CG technique. AO is yet another approximation pushed one step away from realism towards the ease of computation.

    Aztec temple should work just fine. You have to remember though, that the bigger the scene and the more sub-areas it is composed of, the more VPLs you'll need. As we write in the article, some other techniques have to be applied to render more VPLs at high-enough frame rates.

    It also depends what's 'high enough' for you. Crytek is doing some experiments with global illumination in Cryengine 3 (A bit more deferred) - more details will be presented this week at SIGGRAPH. So global illumination might fast enough for shooters pretty soon. Never on Intel 945, though ;)

    Heh, anti-aliasing doesn't work with deferred rendering out of the box, but there is a number of ways to implement it. Also, the application is fill rate bound of course, so the higher resolution you run it in, the higher frame times you'll get.

    Once Unity 2.6 is released, we will publish the project files and you'll be very welcome to experiment with your own setups and scenes. The only reason why we needed 2.6, is that the rendering pipeline requires 16-bit precision render textures, which were not available previously.
     
  15. Yann

    Yann

    Joined:
    Oct 20, 2007
    Posts:
    432
    OMG ! Yet another great feature coming to Unity... can't we take a little pause, please ? just kidding, I want it so bad ! :D
     
  16. jtbentley

    jtbentley

    Joined:
    Jun 30, 2009
    Posts:
    1,397
    If it looks like dirt you've got it too intense and too wide, needs to be tightened up and most likely halved.

    When doing it for ads or archviz, I typically produce a separate AO pass (which is multiplied over the final comp) and a seperate set of mattes for glass (so I can remove AO on glass, where its definitely not appropriate).

    Try not to think of AO's on walls, think of it under couches or in areas where there's tightly bunched geometry, because that's where it becomes worth its weight in gold :)
     
  17. robert

    robert

    Moderator

    Joined:
    Dec 21, 2008
    Posts:
    265
    Exactly, no AO on walls and that was my original point: we excluded AO from our specific scene, where it would look like dirt.

    In deeper creases, folds or holes I agree AO is invaluable, as these areas should be darker regardless of the lighting conditions - but we didn't have any of those geometry features in our scene.
     
  18. yahadi

    yahadi

    Joined:
    Jun 28, 2009
    Posts:
    36
    I understand your scene had to be in a controlled environment but did you think of bringing textures into play? Does the color bleeding take the solid color of the object or can it also calculate it based on the texture.
     
  19. Zante

    Zante

    Joined:
    Mar 29, 2008
    Posts:
    429
    Where's the webplayer?!?!

    *foam*
     
  20. Kuba

    Kuba

    Moderator

    Joined:
    Jan 13, 2009
    Posts:
    416
    The colours on the walls already come from textures, and of course we are sampling the colour from an appropriate mip level not to be fooled by high frequency colour changes. So you can stuff any texture on any surface and the colour bleeding will update accordingly.

    Please read more carefully. From Robert's post and our websites:
    "(Note: the prototype has been developed in an yet unreleased Unity version 2.6. This is why we're not posting the project files yet, nor the web player build, which is actually our target platform.)"
     
  21. seon

    seon

    Joined:
    Jan 10, 2007
    Posts:
    1,441
    Clearly it cant be released until Unity 2.6 ships. So, that would mean there is no ETA.

    I don't see a problem showcasing cool stuff in advance of giving access to it to play with.
     
  22. tmg

    tmg

    Joined:
    Aug 4, 2009
    Posts:
    6
    would be better to post textured screens, simple colored chest texture is fine.
    My concern is light flickering in real game example as only colored (no textured) objects is rare in game.
     
  23. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    The demo doesn't seem to work on my Intel Core Duo 17" iMac, all I get is a black screen. :(
     
  24. robert

    robert

    Moderator

    Joined:
    Dec 21, 2008
    Posts:
    265
    Temporal flickering in instant radiosity implementations is a result of either shooting VPLs in completely different directions from frame to frame (not the case here) or VPLs jumping from one object to another after they were sliding along the surface and have hit the edge. In the latter case a VPL is very likely to drastically change both location and colour.

    You can test how much flickering does it result in our application already: it's hard to image a harder test case than VPLs sliding off a green wall and hitting a more distant white floor.

    As mentioned previously, adding textures with more detail would only mask those errors as well. Also placing a wall with a colourful texture against a white wall is not a hard test case either: interreflection on the white wall will a blend of the colours from the other wall - and not even due to the higher mip level sampling, but to the way the contribution from VPLs nicely blends.

    Also: you would be surprised how much harder test case this apartment scene is compared to, say, a textured Cornell Box with a Stanford Bunny in it ;) But you'll be able to test anything you want once we post the project files.

    Radeon X1600? Hmm, it supports SM 3.0, but maybe you're out of memory. Sorry ;)
     
  25. jcarpay

    jcarpay

    Joined:
    Aug 15, 2008
    Posts:
    561
  26. yahadi

    yahadi

    Joined:
    Jun 28, 2009
    Posts:
    36
    Any updates on this project.

    Is it going to be released now that Unity 2.6 is out?
     
  27. robert

    robert

    Moderator

    Joined:
    Dec 21, 2008
    Posts:
    265
    The complete project files will be available online very soon.

    We just have to find some time to clean stuff up and then you can have it :)
     
  28. MentalFish

    MentalFish

    Joined:
    Nov 2, 2005
    Posts:
    282
    Bump, what's the status on this? :)
     
  29. maxfax2009

    maxfax2009

    Joined:
    Feb 4, 2009
    Posts:
    410
    Bump - when can you download this?
     
  30. God-at-play

    God-at-play

    Joined:
    Nov 3, 2006
    Posts:
    330
    I'm also interested in this. Hope to see it soon :)
     
  31. box01

    box01

    Joined:
    Apr 2, 2009
    Posts:
    62
    any updates? :cry:
     
  32. Per

    Per

    Joined:
    Jun 25, 2009
    Posts:
    460
    Cool stuff, looks like a realtime version of lightcuts to me (or am I wrong?).
     
  33. Tysoe

    Tysoe

    Joined:
    Jul 6, 2009
    Posts:
    577
    very nice :). Maybe in another couple of years when we all have midrange quad core VGA cards we will be able to take this stuff for granted and use it in our games.
     
  34. Charz

    Charz

    Joined:
    Apr 15, 2010
    Posts:
    20
    Hi Robert/Kuba,

    Any update on the instant radiosity implementation?

    wish if you could share the files with rest of us even if they were still in the testing stage.

    Regards
     
  35. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Great stuff... what is its biggest bottleneck?
    Or to say it easier: how many triangles can it manage before dropping under 60 fps?
     
  36. Vinícius Sanctus

    Vinícius Sanctus

    Joined:
    Dec 14, 2009
    Posts:
    282
    Awesome work! Nice curriculum indeed! GZ!
     
  37. Gareth Jones

    Gareth Jones

    Joined:
    Nov 1, 2010
    Posts:
    2
    Otherwise I might have to implement it myself :D
     
  38. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Just do it, Gareth lol :D
     
  39. yjlh1234

    yjlh1234

    Joined:
    Nov 19, 2009
    Posts:
    1
    I think you used "imperfect shadow map"
     
  40. andresp

    andresp

    Joined:
    Aug 12, 2011
    Posts:
    38
    Is this integrated in the latest versions of Unity? If so, how can we achieve this real-time lightning quality?
     
  41. BrUnO-XaVIeR

    BrUnO-XaVIeR

    Joined:
    Dec 6, 2010
    Posts:
    1,687
    Y U NO release thisss???
     
  42. LilWiebe

    LilWiebe

    Joined:
    Sep 25, 2012
    Posts:
    69
    SSAO works if you apply it to the indirect light only, then add direct lighting on top. IDK if you can do this in unity, though...
     
  43. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    951
    SSAO is included with the default post processing effects, but SSAO isn't GI.
     
  44. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
  45. Balint

    Balint

    Joined:
    Sep 24, 2013
    Posts:
    10
    Will this global illumination be in Asset Store? :) Or is it already?