Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Looking for illumination suggestions on mobile devices

Discussion in 'Global Illumination' started by Zape, Oct 7, 2020.

  1. Zape

    Zape

    Joined:
    Jun 12, 2013
    Posts:
    31
    Hi there!

    I'm currently developing a small project that I had in mind for Android/IOS. It's located in a urban small environment and supposed to have a day-night cycle.

    As it is toon style, a directional light with buildings proyecting a few hard shadows and environment lighting should do the trick when daytime. I believe it should be quite cheap in resources.

    My problem comes when night falls. I'm talking about at least 50 street lamps and some moving cars. I believe real lighting is not an option on mobile devices so I'm trying to find a cheap approach for faking them. My idea is about using some kind of fake halos or beams on street lamps made by cones with a transparency shader ( not sure about which shader should I use and how would affect performance rendering up to 20 of this "cones" in the longest street's camera view) and a couple of point or spot lights activated by code in the nearest lamps to avoid being dark inside that cone. Could it be a good approach?

    Any suggestion is welcome, I'm really not expert on illumination despite having read many tutorials and my small knowledge on it is only theoretical.

    Thanks a lot.
     
  2. Zape

    Zape

    Joined:
    Jun 12, 2013
    Posts:
    31
    Oops.
    Didn´t remember to mention. Lightmaps are not an option since the environment is not static and is randomly generated on each game.
    Thanks again
     
  3. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    259
    I'd do a blue tinted directional for the ambient + moon, and then for your street lamps and cars, maybe something that all writes into one pass. Similar to a stencil, but maybe it can be done in a more modern way. The point would be to reduce overdraw, since it seems likely that you'd have multiple overlapping light cones.

    That said, if you can afford the deferred renderer, then you could do real lights, just skip the shadows. I'm not sure if anyone is doing that on mobile though.
     
  4. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,469
    Lightmap can be procedural too, i would run time bake all static light to the map, ie do the compute to a render texture then use the result.
     
  5. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    259
    Yeah if everything is generated once that could work. Is there some runtime baking facility that I'm not aware of, or are you suggesting he write his own runtime baker?
     
  6. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,011
    I believe he’s suggesting the latter.
     
  7. Zape

    Zape

    Joined:
    Jun 12, 2013
    Posts:
    31
    Thanks a lot for your answers.
    Probably I don´t need lightmaps since many of the map elements will be dynamic.
    Will try an approach with a few lights at the time and some faked halos maybe.
     
  8. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,469
    Another solution is a 3d textures (slice atlas if the be doesn't support) where you bake the illumination in each cells, so object just query the result through spatial hash.