Home› Technical Talk

Using lighting in UDK

kevingamerartist
polycounter lvl 6
Offline / Send Message
kevingamerartist polycounter lvl 6
Hi all,
So I have a question about lighting in UDK. I was wondering on how you determine how many lights that need to be in your level/scene? I know some light sources are going to come from the sun if it's during the day, or even during a sunset, and some are going to come from light bulbs, lanterns, etc. However I don't know how many lights you need to use for the environment in general.

Any feedback about this is greatly appreciated. Thank you! :)

Also if you were wondering which version of Unreal I am using, I'm not using Unreal Engine 4, I'm using UDK 2013 I believe.

Replies

  • Eric Chadwick
    As few dynamic lights as possible, because (generally) they slow down the rendering.

    https://udn.epicgames.com/Three/LightingArtistHome.html

    IIRC you'll bake most lights into lightmaps/shadowmaps using Lightmass, and use a few dynamic lights (Dominant Lights) for objects that move around, like characters and vehicles.

    I can't remember when they added Light Environments, but that's a cool way to light moving objects.
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    Yes. There is no "use xy amount of lights" like answer, you should use as much as needed. You should place the lights to the light sources only (as you said, sun, lamps etc) because the another part of the lighting (bounces-gi) will come from the lightmaps. Light sources in UDK can do both static and dynamic lighting at the same time, you just have to enable both channels. And in your object properties, you can choose which one you want to use on the given asset. From my experience, dynamic lights are not so expensive, as long as they don't cast shadows, so the real time shadowing is the expensive, and not the light itself. Again, this is just my experience... There is a big improvement in DX11 mode (deferred), real time lights are a lot more cheaper, but unfortunately its still expensive to get them all cast real time shadows. It will look strange when you'll notice, but still nowadays, not every lights casts shadows in the modern games (lets say GTA5) because its not really possibe to do it if you want acceptable speed.

    Lightmaps costs video memory, and realtime lighting/shadows use the GPU, so both has their positive and negative sides.
    Real time lighting is good in openworld games, where you have day-night cycle, changing lighting, and lightmapping couldn't really work here.
    But if you don't want to have this (changing lighting) , then probably lightmaps are what you need.

    Real time lighting:

    + Fully dynamic lighting and shadows
    + Can be fast if you don't have too much light sources, and they don't cast shadows (or just one of them, such as a sun)
    + Fast to setup, and parameter it
    + Doesn't cost video memory

    - No global illumination (at least in unreal engine)
    - It can go expensive easily
    - done with GPU


    Lightmaps:

    + Global illumination with multiple bounces
    + Ambient occlusion
    + Doesn't use GPU (as I know)
    + No limit of the amount of lights
    + Every light can cast shadows

    - Can't be used in a scene where the lighting is changing (day-night cycle for example)
    - Costs video memory
    - Second UV channels are needed
    - Sharp shadows can be acchieved only with using very high lightmap resolution , which would cost a lot of video memory, especially in a big scene.



    Sometimes you get your total lighting value above 1, because of intersecting light attenuations (or just because you wanted this because of an artistic purpose), and then you need HDR lightmaps to store this correctly, which costs a lot more video memory than a non hdr texture. Theoretically it is possible to clamp the result to be between 0-1 (0-255), but then a shader trick is needed to push it back to the desired level. I don't exactly know how udk deals with this though.


    Light environment is a good invention, it totally works, if you have just a few moving objects (characters/openable doors for example). Then the rest of the scene can use lightmaps, and the moving objects can use this light environment thing. However, its noticeably not so accurate...

    It is possible to fake the GI with some fill lights/environment color, or a sort of image based lighting, so lightmaps are not must needed if you want to get bouce light look, but again, everything has its positive and negative sides, and the good approach depends on the case.
Sign In or Register to comment.