Home Technical Talk

Light-mapping for games

Hi polycounters !

I've been doing some 3d work recently and started to put everything into Unity, but as the built-in lightmapper is a pain in the a** to use : I'm planning to do all the non-dynamic light work in 3dsmax.

The thing is, it's my first-time at lightmapping and I'm stuck at some point.

I have this modular block I duplicate, forming the base of my level. This block is made of a single model, using 1 material (1*diffuse, 1*normal, 1*specular) with 2 sets of UVs (Channel 2 is for the lightmap's UV).
Once the lighting work is done, I simply Render To Texture the lightmap for every block of the level, based on Channel 2 UV.

The question is (assuming I'm using Unity), how can I apply only 1 material to a model (all the blocks are exported into a single FBX) and apply different lightmap texture for each element ?
I keep turning this question around and still got no clue. I can't believe the only solution is to create one material per element (which would be stupid).

Could anyone help me on this ?

I can post pics if needed, but I'm just trying to get the main concepts of this.

Thanks.

aur8l

Replies

  • warby
    Options
    Offline / Send Message
    warby polycounter lvl 18
    *laggy double post*
  • warby
    Options
    Offline / Send Message
    warby polycounter lvl 18
    Just roll with the ineditor solution i guarantee you that what ever max and maya have up their sleeves is even more pain in the ass and you wont EVER get matching lighting on dynamic objects !

    the specific issue that you are outlining has NO solution in maya I doubt max has one either. In maya only unique geometry can be light-mapped so you either merge(destroy) all your instances or you will have a material per object. Neither of those 2 options are solutions as far as i am concerned.
  • aur8l
    Options
    Offline / Send Message
    Seriously, lighting in Unity... I don't think I'm really up to it. I'm getting really strange results every time I try.

    I'm not trying to use the light maps in max but I'm wondering how I can use external light map on single objects that share the same material.

    I think I can do it unwrapping the level in atlas mode. But I still have to figure out how I can apply my max generated light map onto my model in Unity.
  • Eric Chadwick
    Options
    Offline / Send Message
    http://ericchadwick.com/img/env_robot_rising.html

    Unity's lightmapper worked well when I used it about a year ago. It handled all the lightmap assignments automatically, and made layout tweaks much less painful.
  • Evemy
    Options
    Offline / Send Message
    Nice work Eric, really cool video :)
  • passerby
    Options
    Offline / Send Message
    passerby polycounter lvl 12
    just use beast the built in lightmapper of unity, with properly made lightmap UV sets, and a good lightmap red, it actually works really good.

    just make sure you got spilts and padding on your ligjtmap uvs anywhere where you don't want bleed.
  • Eric Chadwick
    Options
    Offline / Send Message
    I let beast do the lightmap UVs, worked great, in fact better than custom UV2 since it wasn't always there. With beast it's just automatic, no worries. YMMV
  • Lamont
    Options
    Offline / Send Message
    Lamont polycounter lvl 15
    I use a mix depending on the environment use. Outdoor scenes, I use Unity with auto unwrap and a HDR image to help get the tone I want.

    The built in lightmapper is really painless. Get to love it ;). There is an add-on for Unity that exposes even more parameters.

    For intimate single rooms, I spend a lot of time doing custom lighting in mental ray (using MR materials in Max) and bake out the results, combine with a custom shader and use in Unity. You can also just render out a exr (make sure it is flattened in PS) and use that in Unity on a lightmap enabled shader.
Sign In or Register to comment.