Home Unity

Localized lighting conditions in games

polycounter lvl 7
Offline / Send Message
Ravenok polycounter lvl 7
I'm trying to plan out how I'm gonna design levels in a game I'm working on.

I'm currently using small terrain chunks bridged together by mesh sections. Each terrain chunk is basically a level which contains various challenges, encounters, puzzles, etc.

Some of the puzzles include navigation through dark areas where you need to help of lighting to know the way. To do this, I need to set up localized lighting conditions within an existing scene, so that some areas will have a certain set of lights applied to them (including directional lights), and some others will not only have a different set of lights, but also a completely different lightmapping solution/GI settings.

I'm working with Unity. Right now the only thing I can think of is actually creating the different terrain chunks as separate scenes, setting up everything in there, and taking care of the transitions through loading. But that's not something I want to do. I'd really rather be able to change lighting conditions on the fly. But in that field, I kinda lack knowledge.

Would appreciate any help :)
Thanks.

Replies

  • Eric Chadwick
    Look up Layers in the manual. You can assign each level to a named Layer, and assign its lights to that same Layer. I haven't tried this particular scenario, but it should work properly.
  • Ravenok
    Offline / Send Message
    Ravenok polycounter lvl 7
    Why was this moved? I actually was asking about general practices in games, not necessarily for unity specifically.

    Either way - regarding layers, it's actually a pretty good solution but in my case I need control over global parameters, like ambient light, reflection intensity, etc (unity specific).

    In the meanwhile we've made a script which connects a trigger to the different parameters and interpolates between "lighting profiles" through time/curve.

    I'll share that when it's properly written, but until then I'd be happy to hear any other possible methods...
  • Eric Chadwick
    My apologies, I thought you were looking for solutions specific to Unity.

    I worked with a custom MMO engine not long ago, which let artists paint invisible regions on the terrain. Each region could have its own set of textures, light settings, fog, bloom, color correction, etc. The changeover was tied to player position in the world, with a fade-in timer (usually 3 - 5 seconds) to prevent jarring sudden changes. The system worked pretty well, you could have the player's lighting transition as they went from a sunlit glade into a dark shadowy forest, and it looked great.

    So, getting back to Unity, maybe you could tie your changes in global settings to the player's position.
  • Ravenok
    Offline / Send Message
    Ravenok polycounter lvl 7
    Yeah, that's basically what the script we made does.

    You define a trigger, and upon entering it, a transition between different lighting conditions occurs. For now it specifically controls a set of parameters in chosen lights and the global lighting parameters, but it can be expanded.

    Thing is, I'm not entirely sure this is the "right way" to do this? It seems a bit hacky, and I'm curious what other methods have been in use.
Sign In or Register to comment.