Search Unity

Question Is It Possible to Not Light Part of a Scene?

Discussion in 'Global Illumination' started by John-B, Feb 10, 2023.

  1. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    I have a scene with several rooms. Each is in its own layer, and each has its own baked lights that light only that room. I'd like to have one room dimly lit, like the lights are turned out. There are no lights in that room, and no lights lighting that room's layer. But it's still lit fairly brightly, a lot brighter than I'd like. I've tried turning off Environment Lighting, and that makes it just slightly dimmer, but it makes the rest of the rooms too dark. Is there a way to make one room/layer in a scene dark?
     
  2. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    I suppose you could use the Indirect Lighting Controller in URP or HDRP. Otherwise, bake your scenes out separately. Light layers for GI are not supported yet.
     
  3. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    Thanks, I'll take a look at the Indirect Lighting Controller.

    I don't know what you mean about baking scenes separately. I thought that's the only way to bake scenes, one at a time. I want to make the lighting in part of the scene different. Is it possible to bake part of a scene without rendering the entire scene? If I make parts of a scene inactive, they don't get baked.
     
  4. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    My apologies, I misunderstood your initial post. Unfortunately, there's no way to bake selected objects or part of the scene yet. That feature is on the roadmap, though.
     
    John-B likes this.
  5. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    I came up with a solution that works pretty well. I added a Canvas with a solid black image with an alpha channel that fills the screen and is behind the UI Canvas. By increasing the image's alpha, I can "dim the lights," or vice versa. I can do it gradually or instantly, like flipping a switch. I also added a camera (child of the main camera, depth only) that only sees one layer. That way I can have the object the user is controlling, along with a few other important objects in the room, brightly lit in an otherwise dark room. I'm actually a bit surprised how well this works.

    Being able to bake only part of a scene would be GREAT! The process is SO time consuming (though MUCH faster since I got an M1 Max). In this project, I have scenes with several different rooms. Any change to any one of the rooms or any of the lights requires the whole scene to be rebaked, during which time I can do almost nothing in Unity. That's not ideal.
     
    kristijonas_unity likes this.
  6. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    That's an interesting workaround. I'd have probably used exposure controls, but then again, you wouldn't be able to dim objects selectively. Could you upload a video of this in action? It would be interesting to see.
     
  7. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    It won't let me upload a movie, but I've attached a couple of screen shots, lights on and lights off. The lighting in the room is minimal, and took some adjusting to get it to look right when the "filter" is applied. One interesting side effect of the way I set this up, with my depth camera having a relatively short range, is that objects that it sees only appear "lit" when the camera is close to them. So objects pop into clear view as they are approached. That part wasn't intentional, but I like the effect.

    I can't find anything about exposure controls. Is that post processing?

    Lights On.jpg
    Lights Off.jpg
     
    kristijonas_unity likes this.
  8. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Thanks for the screenshots, its an interesting approach!
    Yes, exposure controls are part of post processing. Here are the links on how to set it up it URP and HDRP, if you're interested. It's worth mentioning that URP doesn't have auto exposure yet.