Search Unity

Ideal lighting for procgen levels with modular pieces

Discussion in 'General Graphics' started by Reverend-Speed, Feb 4, 2019.

  1. Reverend-Speed

    Reverend-Speed

    Joined:
    Mar 28, 2011
    Posts:
    284
    Hey folks, puzzling over some lighting issues and I'm hoping I can get some advice. I have some experience with coding and modelling, as well as baking lights, normals, etc.

    However - I've hit a bit of a mental block on the following topic, so please be gentle. Eli5... =D

    I'm experimenting with a procedural built 3D game environment which will be played from an Axonometric angle with perspective. A good example might be Tiny Keep or Path of Exile, etc.

    I'm presently studying this page in an attempt to identify the best lighting approach for the 3D modules which will be swapped, rotated 90 degrees on Y, matched etc during runtime to make the levels.

    Baking the lighting with Enlighten + lightprobes or precomputed GI + lightprobes for seems like it would be a waste of time, as modules will have their own light sources, which could clash with nearby baked lightsources (eg. spotlight aimed to the left of module one is not received by module two (to the left of module one).

    However - looking at articles like this one seems to suggest that I should be able to build lightmaps for each module. So I'm a bit confused.

    My current thinking is that I should employ Basic Realtime and try to overcome the limitations of the lighting through stylistic decisions (potentially recalling visual standards of earlier games with no bounces).


    However, further down on the Unity Lighting Best Practices page, it suggests that I should be trying for All Baked Lighting and Lightprobes,
    Baked lighting is generally useful for games where run-time performance is an issue but there’s room in memory, such as top-down isometric mobile games and high frame-rate VR games.
    Isometric is a subset of Axonometric, so perhaps I should be looking at this...?

    In summary, 'halp'.

    On a related note, any thoughts on how the modules should be built for lighting? Obviously floors and ceilings will need to be made visible/invisible in order to suit camera positioning, but I'm having issues where light is passing through single-face walls (due, presumably, to the normal orientation). (Eg. if a room is made from a cube with all faces made to face inwards, light shone from outside the cube towards the cube centre will shine 'through' the faces and illuminate the interior.

    While the Mesh Renderer has an enum labled Cast Shadows with an option called 'Two Sided', which solves this problem - is it worth using this option instead of biting the bullet and just making the walls 'solid' rectangular cuboids, with 'outward' facing normals? I know that if I have a lot of modules, then this is potentially adding faces which will never be seen but will still have to be calculated (though most of them should be fairly rudimentary walls) - is this a cost worth incurring in order to simplify lighting and prevent light leaks?



    Finally, on light leaks, I note that on module tests where I've built out all the walls, that I'm still getting light leaks with spot lights (note the floors of the modules). Wheras the module on the far right of the image has had the 'outer' faces of the walls removed (so the directional light shines in through the roof and the spotlight clearly shines through the back wall), the other modules retain their 'outer' faces and have been variously assembled from separate walls and had their walls 'welded' together (so the walls share vertices with their neighbours). No matter what, I'm still getting some light leak! The spotlight intensity is set to 4, so I presume I just need to keep the intensity down and make peace with the lighting issue?

    Thanks to anyone who's spent some time looking at this. I've been able to avoid substantially engaging with Unity's lighting solutions for a while (either 2D stuff or I just baked it and it looked great), but I need to find some definitive answers here.

    --Rev