Lightmapping Problem (3ds Max to Unity)

I’m having some difficulty in setting up my Lightmapped materials between 3ds max and Unity.

I have around 15 objects each using multisub object materials in 3ds max. Each multisub object material in max has around 10-15 materials that have a diffuse material set and a lightmap set in the self illumination slot on channel 2. Opening the FBX file in ascii confirms the channel 2 UV data is being exported or at least its in the file.

When I load the FBX into Unity, I’ll pick one of my objects in the FBX and choose one of its material elements and change the shader to lightmapped. When I assign the lightmap texture to the lightmap slot it assigns the lightmap texture to the diffuse slot of the material below. So I effectively can’t assign any lightmaps.

Another problem I’m having is Unity seems to be making up material names instead of getting them from the FBX. In Max I carefully assigned multisub materials to the objects so not one material is shared. This is because each object uses a different lightmap. However in Unity some of the materials are shared between different objects.

I’m not sure whats happening because early on in building the scene I made sure lightmaps using the multisub objects and they did. I’m using max 2010 and Unity 1.6

I now think the problem is in Unity and not in the FBX files. The material bug happens when setting a bump map too. The bump map will go in the material below instead of the intended material. I will install Unity 2.6.1 and see if the bug still happens and report back.

For my other problem I fixed the materials being shared by setting the FBX import option to generation per material rather than per texture.

Ok I now have a work around but the bug definately lies with Unity.

As the FBX is imported the generated materials are all standard Diffuse shaders. I’ve discovered if I changed the shader to lightmapped/diffuse and set the lightmap it affects the material below. However I set the shader to lightmapped/diffuse and restart unity, I can set the material properly!

It’s a bit fiddly but at least I can carry on and it also proves my UV sets were exporting fine :slight_smile:

Its not a bug, its how Unity works. You have to change the material in Unity as you describe :wink:

Ah! You learn something every day! It does seem a little strange but it works. I’ve found you don’t need to restart Unity just select a different object and go back to the materials and it will work.

What will work?
:wink:
Tell me I wanna learn something too :wink:

When I say it’ll work I mean that when you apply a texture in the lightmap slot it works :slight_smile: Before it was changing the material below instead of the intended material.