Search Unity

N00b questions on mixing (or not) GI and Baked lighting

Discussion in 'Global Illumination' started by vitorenes, Jun 22, 2016.

  1. vitorenes

    vitorenes

    Joined:
    Sep 17, 2013
    Posts:
    10
    Hello, wonderful lurkers of the Unity intertubes.

    I'll try to explain the best I can what I need to achieve, to see if anybody has any suggestions on how to approach this; I have, in fact, tried to come up with something myself, but being the complete n00b I am and not understanding the nuances of Enlighten/Unity lightmaps/etc., have not been successful - like, at all.

    Here's the "bullet list" of WHAT NEEDS TO HAPPEN:

    - It is a very basic visualization application (think somewhat very basic archviz)
    - The objective is to have a relatively simple set of scenes, i.e. "rooms", that the user can select/switch to;
    - Each room needs to be lit (obviously) in a mostly "realistic" way, that is: sunlit plus indoor lighting (if needed) so that it leans more towards a "photorealistic" look (because, archviz);
    - Inside each room there is, initially, ONE single piece of furniture "on display" (i.e., a sofa);
    - The user can change, for example, the material (fabric) of the sofa, color, etc., and move the camera around to see the furniture piece from any desired angle;
    - Finally, the user can also change THE MODEL, that is: the displayed piece can be "replaced" by another model (i.e., some other model of sofa);

    And that is basically it.

    WHAT IS DONE:

    So... here's the thing: everything is done ("functionally"-wise): the user can change scenes, can change the sofa materials, colors, pan the camera, and even change the piece (model) on display. THE PROBLEM is the lighting. I've tried (I believe) almost every possible suggestion I could find/derive/infer from all posts, tutorials, books, Youtube videos and substance-induced trances (kiddin'...), from player settings to lighting tab configurations, and here's where I am currently and what I am having trouble with:

    - I tried to do everything with real time lighting, and it worked - SORT OF. I managed to create an acceptable look with all-realtime lights, but performance was horrendous, especially on mobile (tablets); also, the shadows were "meh", but that I can live with;

    - I also tried to bake the lighting of the "room" and leave the furniture piece as a dynamic object, lit with a light probe cage (effectively, I tried mixed lighting - I think?); looked kind of OK, but I still don't know how to get shadows from the sofa onto the floor so it doesn't look like it's floating midair;

    - Finally, I was going to bake lighting for EVERYTHING, but then I stopped before I even started because I have no idea how am I going to achieve shadows for the different furniture models in the SAME room, since the shadows would be baked onto the scene, thus making it impossible to change the models;

    SO THE HELP I NEED IS:

    What do you guys recon is the best approach to deal with this scenario?
    Should I stick with all-realtime lighting and try and figure out a way to make it performant?
    Any tricks or techniques you can suggest to solve this problem would be very much appreciated.

    Also, if anybody with a suggestion needs more information, please ask.

    Many, many thanks in advance for anything - even if you just write to call me an ignorant ;-)
     
  2. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    501
    Are you using point / spot lights in your indoor lighting? If so, that'll be your biggest performance killer in real time on mobile devices. You should have a single real time directional light, giving your relatively cheap shadows in forward rendering, and bake any point / spot lights to light up the rooms. Have the rooms be lightmap static so they can be baked, and leave your furniture as dynamic, so they will only cast shadow from the real time directional light.

    Alternatively, it is also possible to exchange lightmaps, allowing you to bake all lighting and swapping lightmaps along with the furniture. I haven't yet done that myself though, but this script seems like a good place to start. If that doesn't end up working, you could also bake a room instance for every piece of furniture, and swap out entire rooms including the object on display. Still, the single real time directional light route is much easier and more maintainable.
     
    Last edited: Jun 23, 2016
    vitorenes likes this.
  3. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,913
    If it has to run on mobile, I would just do your 1st option - Baked GI for the room with Light Probes for dynamic objects. They won't have shadows, so you will have to use a custom blob shadow [1, 2, 3] for the shadows.

    If it was for desktop I would use Precomputed GI with lights casting shadows. Then use an image effect to get the AO effect, etc.
     
  4. vitorenes

    vitorenes

    Joined:
    Sep 17, 2013
    Posts:
    10
    Thomas:

    Thank you for your reply.
    I will try the single directional light approach you suggest, and will post the results of experimentation here.

    Also, Stardog's answer suggests something else I wasn't really aware of (Projectors, one of the links he wrote there, and shadow blobs) that could help me with a different approach should your suggestion not work for me.

    Anyway, thanks! Will keep you posted.
     
  5. vitorenes

    vitorenes

    Joined:
    Sep 17, 2013
    Posts:
    10
    Thank you for these links, Stardog - I wasn't even aware of shadow blobs or projectors. This could be also an interesting option!