Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

GI in Caves/Interiors

Discussion in 'Unity 5 Pre-order Beta' started by infinitypbr, Oct 30, 2014.

  1. infinitypbr

    infinitypbr

    Joined:
    Nov 28, 2012
    Posts:
    3,149
    It seems that GI is amazing, but isn't really made for interiors, is that correct?
     
  2. sqallpl

    sqallpl

    Joined:
    Oct 22, 2013
    Posts:
    384
    Why do you think that it's not for them?
     
  3. infinitypbr

    infinitypbr

    Joined:
    Nov 28, 2012
    Posts:
    3,149
    GI, if I'm not mistaken, uses a directional light and a skybox. Interiors wouldn't usually have either, right? You could probably do some cool effects using crazy skyboxes in a top down -- but otherwise, ceilings will block both light.

    Does GI do something besides work w/ the directional and sky box?
     
  4. sqallpl

    sqallpl

    Joined:
    Oct 22, 2013
    Posts:
    384
    AFAIK GI can bounce directional light, spot/point lights (not working with shadows from these lights at the moment), emissive shader and environment light.

    I would separate 'interiors' into two categories.

    One is interiors that are affected by light that is coming from doors/windows etc.
    In this case you can get great results with direct light and environment light that gets inside and bounces there. Even a scene without a directional light can can look great if the skybox is bright enough, interior is exposed to it via windows and other holes and bounce intensity is not too small.

    Another case is with interiors that are not affected by directional light or environment light (skybox) like caves, basements and other places without any windows and other 'holes'.
    In this case you can use spotlights/pointlights (torches, lamps, laterns, fire etc.), both of them can be calculated and bounced by GI. You can even utilize emission feature in the standard shader (embers, magic, neons etc.) because it works with the GI too.
     
    infinitypbr likes this.
  5. pojoih

    pojoih

    Joined:
    Mar 30, 2013
    Posts:
    226
    What if the interiour is movable, for example a Cockpit of a ships bridge?
     
  6. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,657
    No, it can use them as light sources but it by no means has to. You can also use point/spot lights and emissive materials as light sources.
     
  7. Kuba

    Kuba

    Moderator

    Joined:
    Jan 13, 2009
    Posts:
    416
    Generally what sqallpl said. Also we're hard at work on much improved directional lightmaps, so if you have an area that is lit only by lightmaps it won't be limited to just being flat and diffuse. More details soonish.
     
    infinitypbr likes this.
  8. Kuba

    Kuba

    Moderator

    Joined:
    Jan 13, 2009
    Posts:
    416
    That's a good use case, thanks for bringing it up.

    It is possible right now but with some caveats. If you move your geometry marked as lightmap static baked GI will work just fine and will of course not change.
    Realtime GI will properly take into account the influence from directional lights. It will still however think that it's in the same place as where it was precomputed, so any local lights (point and spot lights) that are placed relatively to the ship will only affect the direct lighting if the ship is moved. To get GI back you need to duplicate the lights and keep them relative to ship's position at precompute time. So best to precompute it somewhere where the ship can't normally go.

    This workaround will not have any noticeable performance impact as one set of lights will only affect direct lighting (so what is calculated realtime in the shader) and the other set will only affect realtime GI (so what you get via realtime lightmaps or realtime light probes).

    We will introduce some API that will allow you to specify that a certain system has now been moved, so that the trickery above will not be necessary. It will also work for scenes assembled from pieces (say, rooms) at runtime and such.
     
  9. sqallpl

    sqallpl

    Joined:
    Oct 22, 2013
    Posts:
    384
    I've noticed that at this moment when the surface is only lit by the bounced light it won't use a normal map but in case when I have a light probe and there is a dynamic object inside it, the normal map works fine even if the object is lit only by a bounced light.

    Does it mean that you are working on a feature that will be able to use normal maps and other maps for static objects when they are only lit by bounced light and are not affected by manually placed light probes?
     
  10. Kuba

    Kuba

    Moderator

    Joined:
    Jan 13, 2009
    Posts:
    416
    Yes. Light probes are encoding lighting in SH (L1 for realtime probes and L2 for baked) which stores the information on lighting arriving at the point from all the directions. The Standard shader is (partially) evaluating SH with the normal coming from the normal map. So here everything works as expected.

    Lightmaps typically encode just the diffuse response of the surface (so (N x L) * light.color * light.intensity). With just this data it's not possible to sensibly affect the output with perturbed normals from the normal map. We're now storing more data to allow for that and more...
     
  11. BabyDinoHerd

    BabyDinoHerd

    Joined:
    Mar 27, 2014
    Posts:
    21
    Just wanted to clarify that things will work the way I expect them to, regarding scenes assembled from pre-built chunks, as you've mentioned here and was also mentioned on the GI blog entry.

    Let's say I have a bunch of room prefabs, each of which has some static geometry. If I put one in a scene, Enlighten will go and compute whatever maps in needs for Dynamic GI -- so far so good.

    Will I be able to do something equivalently to:
    • Precompute the GI for each prefab separately
    • Save the GI maps along with the prefab somehow
    • Instantiate a bunch of prefabs at runtime, each using its precomputed GI
    It seems that this is possible -- indeed the blog seems to imply that in the future one might be able to get bounce between precomputed chunks.

    But for now, where each room has no GI impact on the other rooms, will this be possible? Is it possible now, in 5.0, 5.1 ... ?

    Thanks!