Search Unity

Lightmapping and Normal Maps

Discussion in 'Editor & General Support' started by nevets2001uk, Jan 20, 2011.

  1. nevets2001uk

    nevets2001uk

    Joined:
    Sep 20, 2010
    Posts:
    4
    I've been using Unity for a couple of weeks now for a game level I'm developing. I've created a complete scene in 3ds max which I'm exporting into Unity, adding lights and then baking a beast lightmap. So far I've figured out what I needed to but today I added a normal map to an object (baked from a high poly model) and spent ages working out why it didn't show up. Until that was I realised that with a lightmap on it wouldn't show.

    I've researched it and just wanted to check I'm correct. In the standard version I cannot have a lightmap generated in Unity and have bump + spec maps on the materials? If I want to do this dual lightmaps seem to be a solution if I go pro and use deferred lighting (not an option for now). Is my only other option to manually unwrap in Max to UV 2 and bake a lightmap there which then I use in Unity with the lightmap shaders?

    My main reason for the lightmap is that it's a complex indoor scene with a lot of lighting needed for realism. Whilst realtime lighting may be possible down the line (if I go pro) I think the hit will be too bit. So I'd like to have a lightmap for the higher quality shadows and AO but still have some lights in the scene for bump maps and spec to function.

    Any advise is most welcome.
     
  2. sccrstud92

    sccrstud92

    Joined:
    Jan 20, 2011
    Posts:
    145
    I ran into the same problem when lighting my outdoor scene. I had a bump map shader which bumped each texture I was using, but when I applied a lightmap, the bumping didn't work. When it generates code to work with lightmaps, it ignores the normals and lights that are baked. To fix this I had to hack the compiled shader. I made it use the normals from the bump maps to lighten or darken the lightmap value at that pixel, depending on whether it was pointing towards or away from the light source. Unfortunately, this was for terrain, however, I think you might be able to accomplish something similar with regular meshes.
     
  3. holmeren

    holmeren

    Joined:
    Dec 12, 2006
    Posts:
    300
    After we got Beast:
    If you need Lightmaps and bump maps you need a pixel light AND "Differed Lighting", but then the close environment are shadowed with realtime shadows and only far away are shadowed with your AO/lightmap. (Dual lightmapping).
     
  4. Sosuke

    Sosuke

    Joined:
    Dec 19, 2010
    Posts:
    13
    I am pretty new to all of this and I was wondering how you go about setting up both the pixel light AND differed lighting?
     
  5. francksitbon

    francksitbon

    Joined:
    Jan 22, 2010
    Posts:
    268
    I have the same problem using lightmapper and normal maps. all normal maps do not render. Is there any tutorial to have unity rendered lightmaps + normal maps ?
     
  6. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,750
    Are you all using dual lightmaps?
     
  7. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    Might have been mentioned, but for those who can't/don't want, to use dual lightmaps, or simply MUST have normal maps visible at a distance, is to simply add some lighting that's set to realtime only. Change their brightness so not to blow out the lightmaps effect, but be bright enough to make the normal maps show a little (you don't need them to be too heavy, as you wont see much normal map detail at a great distance anyway). Keep them small and not over the top and you get the best of both worlds.

    For interior area's, just a few well placed point lights to bring out the normal map details where required. For exteriors just a single no shadow distant light should do the trick, low intensity in all cases and the normal map will still be visible without effecting the overall lighting of the scene.
     
  8. francksitbon

    francksitbon

    Joined:
    Jan 22, 2010
    Posts:
    268
    ok thanks; i understand better why my normal were no more rendered.
     
  9. John_Doe

    John_Doe

    Joined:
    Mar 23, 2011
    Posts:
    8
    hi there guys,

    I'm having problems with the matter too - after wondering whats up with the normal/specmap render I came up with a similar solution Frank Oz mentioned, but its far from satisfying;
    I don't see this Duallightmap FX work at all
    normal specmap showing up only with annoying finetune of two lights(1 for baked and 1 for realtime lighting) - even with this workaround itz too faint to be recognised or way too overlighted

    there's the big question -
    Is it working correctly only with the Proversion and if so are u all using Pro and still having probs with this?

    And is the indie user doomed to use either normal/spec FX (to have txtures look at least a lil up to date, but objcts look like just stuck together) -or- diffuse static lightmaps for the too oldfashioned looks??

    would be nice to get some answers or shared xperiences ..
    greetings J.D
     
  10. Sicklilmonky

    Sicklilmonky

    Joined:
    Feb 15, 2011
    Posts:
    30
    I tried using dual light maps with the Leagacy Lightmapped Shaders for Bumped Diffuse and it still aint doing jack for allowing my bump maps to show. Is this a Pro only feature??
     
  11. Tiles

    Tiles

    Joined:
    Feb 5, 2010
    Posts:
    2,481
    There is a somehow working solution. Have a look here:

    http://forum.unity3d.com/threads/12...map-AND-lightmap?highlight=normalmap+lightmap

    You may need to investigate if the shader that refused to work with 3.50 now works with 3.51. I´ve decided to work without normalmaps for now. Maybe i come back to this issue when my game is close to finished. And maybe we have Unity version 4 then, with another lighting engine that takes this issue into account :)