Home Technical Talk

Talk to me about Lightmaps.

It's common knowledge that college only teaches you 10% of what you need to know in a professional setting. For my college experience, lightmapping fell into that 90% that wasn't discussed.

Unfortunately, it's also a topic that was cited as a weakness of mine when I had my portfolio reviewed at GDC. So I'm wondering if someone would be so kind as to answer some questions about lightmapping for me.

regardless of the modeling package it's done in, I'm noticing that part of the method of setting up a lightmap is creating a second UV set, unwrapping the scene in Atlas mode, and exporting in a format that can handle multiple UV sets.

Why is this a necessity? Is it just to get around problems caused by surfaces that share UV space?
What filetypes will handle exporting multiple UVs?
Is a lightmap of any use inside the modeling package, or is its function limited strictly to game engines?

A lot of the lightmap tutorials I've read are old - old enough to refer to Quake and Doom as current-gen games - and refer to reducing your lightmap per object to 32 pixels. I can understand using a smaller lightmap, given its only function is influencing light, but what's a more realistic size to work with for current-gen game consoles and computers?

This is my first post, so I apologize if this is in the wrong place. :)
Thanks for your time!

Replies

  • Noors
    Options
    Offline / Send Message
    Noors greentooth
    Hi and welcome !
    You can start here :
    http://wiki.polycount.com/LightMap
    and read the threads linked. Then if you still have questions, come back !
  • jeremiah_bigley
    Options
    Offline / Send Message
    jeremiah_bigley polycounter lvl 12
    And here is a free video tutorial on creating a UV Channel for it in Max ;)
    even if you are not using max you should still watch it because he talks about things you should keep in mind while creating a uv channel for one.
    http://www.3dmotive.com/product-udk-lightmaps
  • SanderDL
    Options
    Offline / Send Message
    SanderDL polycounter lvl 7
    yeah lightmaps used to make me pull my hair aswell. The most helpfull tutorial I've seen so far on the subject:

    http://www.3dmotive.com/product-udk-lightmaps


    To awnser some of your questions:


    You need a 2nd UV channel because in order to bake lightmaps you have to have everything unwrapped uniquely.

    32x32 lightmap may seem a little low but you will find it still gives nice shadows. Remember that every instance of an object gets an unique lightmap. Still you can go higher than 32x32 now a days.

    EDIT:

    lol posted while I was writing my post... still 3dmotive is really good.
  • jeremiah_bigley
    Options
    Offline / Send Message
    jeremiah_bigley polycounter lvl 12
    SanderDL wrote: »
    lol posted while I was writing my post... still 3dmotive is really good.

    ;)
  • Ben Apuna
    Options
    Offline / Send Message
    Here's another one for UE3:

    http://stephenjameson.com/tutorials/lightmap-uvs-tutorial/

    32 x 32 pixels can be fine depending on the size of your object and the amount of instances there are and how detailed the shadow information needs to be.

    Light maps do add up after a while even at such small resolutions.
  • Martin Henriksson
    Options
    Offline / Send Message
    Martin Henriksson polycounter lvl 9
    Is a lightmap of any use inside the modeling package, or is its function limited strictly to game engines?

    Lightmaps are great inside the modelling package aswell if you want to showcase your models in the viewport for whatever reason. I dont know how to do it in max but in maya you need to create a layered texture and link one UV set to the diffuse of the object and one UV set to the lightmap of the scene.
  • Ott
    Options
    Offline / Send Message
    Ott polycounter lvl 13
    Thanks for the pimp guys!

    I will admit that when I recorded that tutorial I didn't go into nearly enough specifics of "best practices" and all the nuances of what makes a good lightmap.

    Here's some additional things to consider:

    Hide, hide, hide those seams! Just like a good texture map, hiding your lightmap seams is just as important. Nothing will make your object look off than a giant shadow seam right at the corner.

    Straighten your UVs! Don't go completely overboard, but do your absolute best to straighten out your UV edges whenever feasible. In Max or Maya, take full advantage of those alignment tools to avoid artifacts along your lightmap.

    Just as important as straightening them, make sure your UVs aren't bent at any odd angles. Perfectly straight up-and-down or left-to-right. Don't have a flat surface bent at some weird angle just because it will pack better. The lighting will almost always be better when the UVs are straight!

    Using the "Auto-Pack" tools is a good start in 3dsMax, just make sure you don't turn "Rotate Clusters" on. Keep those UVs straight up and down! :)

    Always consider padding between resolution. In the video, I probably pack them a bit too tight for such a small asset that would likely get a very small lightmap, so consider the scale of the object, the possible final scale of the lightmap, and pack accordingly.


    Hope that helps!
  • Noors
    Options
    Offline / Send Message
    Noors greentooth
    I think this has been debated elsewhere, but do lighmaps usually use mipmaping in games or is it desactivated ?
  • o2car
    Options
    Offline / Send Message
    o2car polycounter lvl 16
    Games nowadays often use ligtmaps only for indirect light and can thus be quite small. This information can even in some cases be saved in the vertexcoloring. Cast shadows is in turn usually realtime since newer games are more dynamical than what they used to be.
  • Gestalt
    Options
    Offline / Send Message
    Gestalt polycounter lvl 11
    The lightmaps have to have unique UVs because each part of the mesh gets different lighting info. You could technically use one UV layout if your UVs were all unique with no overlap, but generally that isn't a wise way to texture and there are specific ways to lay out lightmass UVs to avoid problems. The lightmap size can be quite small in UDK because of its use for indirect lighting, which is blended and doesn't require detail. I generally use 64 so that I can have 3pixel padding between all of my islands.

    Some general advice on avoiding seams:
    -Obey the 3pixel padding rule between islands.
    -Place the UV seams where there are sharp edges on the mesh, and connect islands where the surface is flat (so if you have a wall you want the whole thing to be connected if possible).
    -Snap edges to the grid (to the pixels) whenever possible, and try to make them straight (horizontal or vertical). So if you are planning to use a 64pixel lightmap then plan the UV coordinates accordingly (integer values between 0 and 64).
    -Make sure none of the islands are flipped or overlapping on the lightmap.
    -On your normal map if you are flipping(mirroring) islands, flip horizontally across the y axis (so the seam is running vertically).
    -Turn the Normal Boost Influence in the World Properties down to 0, specifically if you are mirroring your textures.

    If things still don't work out and you still get seams, try turning the lightmass res to 0 which I believe will make the mesh use vertex lighting. If that still doesn't work out or if you prefer not to take that route, then you can hide your seems by obscure placement or by covering them with another mesh.

    I also believe that the skeletal meshes use vertex lighting, which I believe would make lightmass UVs negligible (someone clarify if the lightmass UVs are used in any way on skeletal meshes?). If they aren't then that means you are dealing with lightmass UVs for mostly static environment/architectural assets (not so bad, unlike an organic character which could be a nightmare). I'm fuzzy on this since I don't do udk skeletal work as of now, so if anyone has some clearer info that'd be great!
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Best solution I found bake them in your Engine of choice, export it, pad it, and re-import it as Lightmap.

    I don't understand why so many engines lack Lightmap bleeding/padding, not everyone has access to ingame code.
  • Accipiter
    Options
    Offline / Send Message
    Accipiter triangle
    Gestalt wrote: »
    I also believe that the skeletal meshes use vertex lighting, which I believe would make lightmass UVs negligible (someone clarify if the lightmass UVs are used in any way on skeletal meshes?). If they aren't then that means you are dealing with lightmass UVs for mostly static environment/architectural assets (not so bad, unlike an organic character which could be a nightmare). I'm fuzzy on this since I don't do udk skeletal work as of now, so if anyone has some clearer info that'd be great!

    Not wanting to high jack this thread, but I've been searching around and this is my question, "What about skeletal meshes and lightmaps?"

    I've got several skeletal mesh objects in a scene and I'd like to increase the resolution for those specific objects. Is there an attribute for resolution on those specific assets? Or do you have to do something different for those skeletal meshes?

    I keep drilling through menus and Google searching but haven't found anything yet.
  • Accipiter
    Options
    Offline / Send Message
    Accipiter triangle
    Why is it I find answers after posting...?

    Skeletal meshes can't use lightmaps.
    They use depth buffer shadows and/or stencil shadows depending on the types of lights affecting the mesh.

    I'll have to check all my lighting attributes.

    Apparently you can only use one UV channel too for Skeletal Meshs, which is a big pain.
  • Fingus
    Options
    Offline / Send Message
    Fingus polycounter lvl 11
    Well the thing with Lightmaps is that they are baked and stored as a texture because it allows you to do really complex and heavy lighting calculations ahead of time and save your game engine from doing all the hard work. And it lets you do stuff that is still infeasible to render realtime like global illumination and ambient occlusion. This unfortunately means that the objects can't move since the lighting is static. So characters and dynamic props can't be lightmapped since they will move around a lot.
    Hope that makes sense.
  • djoexe
    Options
    Offline / Send Message
    djoexe polycounter lvl 7
    Fingus... GI is feasible in realtime and Ambiant occlusion as well. Its a optimisation choice that made its time IMO. You completely limit your level to be with a specific time of day, wich is sad. You can turn on Dynamic lighting in UDK but it performs way better with lightmaps Unreal Engine 4 will use fully dynamic Global illumination.
Sign In or Register to comment.