| View previous topic :: View next topic |
3dmaxter

Joined: 16 May 2009 Posts: 3 Location: Bandung. Indonesia
|
Posted: Sun May 17, 2009 12:08 pm Post subject: 3dsmax lightmap small tutorial |
|
|
|
Hello. I just wanna share my way on doing Lightmap in 3dsmax to unity. I read many post asking how to do this, and I want to share with all of you. Please tell me if there is a better way.
1. When you finish uvw your model save it to .uvw file
2. Create new uvw and change it to channel 2. Load the uvw you created earlier. This give you better result than using automatic uvw.
3. hit (0) to open the render to texture window. Select "Use Existing Channel", change the Channel to "2", choose add "Lightingmap".
The image you see when rendering is not the real result. The real image was stored in your 3dsmax folder. usually it stored like this (My Documents/3dsmax/sceneassets/images) look for your model name with "LightingMap" on the back. Usually a TGA file like this.
4. The easier way is to "Pick Material from Object" and then copy the "Baked Material" to an empty slot. Because .fbx exporter currently doesn't support "Shell Material".
5. After you assign the new baked material to the model, export the model with fbx extension. Here I use cm, embed textures, convert to portable format (TIFF).
6. When you open your unity project, and Import the model, you will see it's only the diffuse texture that was exported from 3dsmax. And no LightMap texture. My way is to import the LightMap texture that 3dsmax stored in (My Documents/3dsmax/sceneassets/images). And then add it into fbm folder of your model.
7. After that done. Change your model material to a Lightmapped material. And add the Lightmap texture into the slot.
Hoorayyy..!!!
Next I will update the post with "uvw tilling model lightmapped"
_________________ Artist should always remember the technical boundaries.
http://wicak3dan.wordpress.com |
|
| Back to top |
|
|
aNTeNNa trEE Unity Demo Team

Joined: 30 Oct 2005 Posts: 3528 Location: Unity HQ, Copenhagen
|
Posted: Sun May 17, 2009 12:40 pm Post subject: |
|
|
|
Good stuff! Adding to the FAQ
_________________ Ethan Vosburgh - Artist at Unity Technologies
http://twitter.com/antenna_tree |
|
| Back to top |
|
|
holmeren Unity Studios
Joined: 12 Dec 2006 Posts: 274 Location: Århus/Denmark
|
Posted: Mon May 18, 2009 7:49 pm Post subject: |
|
|
|
Good and simple, nice one...
One little note:
Max 2009 has become quite unstable in its UVs when working with more than one UV. So its a VERY good idea to save ALL your UVs just as you save textures and models.
You could, in your "Render To Textures" settings, set your render to not use Shell Mat. and then choose the baked texture to be applied to your Diffuse instead of the Shell Mat.
But hey its minor!
_________________ www.holmerens.dk
www.unity-studios.com
The mind is like a parachute. It works best when open |
|
| Back to top |
|
|
3dmaxter

Joined: 16 May 2009 Posts: 3 Location: Bandung. Indonesia
|
Posted: Wed May 20, 2009 7:46 pm Post subject: |
|
|
|
Hi guys, sorry for the delay hehe, the world keep me busy this whole week XD
Wow Thank you aNTeNNa trEE for putting my thread on the FAQ ^^
"Here it is!! Lightmap with tilling textures"
First let me explain, I am using 2 different way of using Lightmap for this one. You know why later on.
1. Here I have 2 objects (interior, and sofa). I highlighted the texture so you can see them clearly. There are 8 textures (7 for interior and 1 for sofa).
2. Unwrap UVW set (ch 1) hit save.
3. Unwrap UVW set (ch 2) load from the first channel.
4. In Baked Material option, choose "Output into Source" and "Keep Baked Materials". This option will automatically update your original material without using a shell material again. Thanks to holmeren for the update ^^. Hit (0) for render to texture window.
--> result
5. Repeat the process for the sofa. (Explained on top of this page).
Hit M to and see your new baked material (Check it out! the "Self Illumination Slot" is now containing the Lighting Map texture.
6. Export to FBX
7. Open Unity and import the asset. Because in 3dsmax we use 8 texture for the model, so unity will assign them into 8 materials. As usual the lightmap textures aren't exported along with them.
Import manually the lightmap texture from your 3dsmax folder (MyDocuments/3dsmax/sceneassets/images) look for your model name with LightingMap on the back.
In this case I have 2 (sofaLightingMap.TGA, and wallLightingMap.TGA).
8. With all our texture assembled, we are now ready to change the default material into "Lightmapped" material. I choose Lighmapped/VertexLit. Assign the correct lightmap texture to the correct material model.
Yess!! The Lightmap placed correctly.
9. Time to "tilling" our interior textures.
Yes!! Finish!!
----------------------------------------------------
----------------------------------------------------
What if I want to use non tilling texture along with the tilling textures? Well I came across some error in exporting as well but I found a way to get that done.
<Different solution>
1. The uvw I use is the same as before. Only this time with different texture for the wall.
(1 for the wall, 1 for the floor, and 1 for the sofa).
The wall texture
2. Exporting as usual.
3. Import them into Unity and change the diffuse material to Lightmapped material.
4. Apply the Lightmap texture, and tile only the floor texture.
5. Finish!!
----------------------------------------------------
----------------------------------------------------
Conclusion...and problems
First method:
We will have lot of material in our mesh because we assign a lot of different texture in one model. Smaller textures but with sharper image, thanks to the tilling system. Add 30 kb.Mat
Second method:
We use less material and less texture, but with bigger resolution (my custom texture wall have 512x512 resolution). Add 11 kb .Mat
I don't know the performance difference between those two. So if anyone can share your opinion, I'd be most grateful.
So that finished my small lighting map tutorial.
Good Luck on your project, (mine too hehe) and Thank you very much to Unity3D team. Cheers.
_________________ Artist should always remember the technical boundaries.
http://wicak3dan.wordpress.com |
|
| Back to top |
|
|
holmeren Unity Studios
Joined: 12 Dec 2006 Posts: 274 Location: Århus/Denmark
|
|
| Back to top |
|
|
hike1
Joined: 06 Sep 2009 Posts: 16 Location: Arizona
|
Posted: Sat Sep 19, 2009 10:59 pm Post subject: |
|
|
|
I followed this but I only got a small portion of the lightmap
to render, scaling the uvs down, changing render size had
no effect.
Max 9 file
http://terrymorgan.net/floor_plan_7b.zip
|
|
| Back to top |
|
|
designtek

Joined: 14 Mar 2009 Posts: 136 Location: San Diego, CA
|
Posted: Fri Sep 25, 2009 11:09 pm Post subject: |
|
|
|
I've been trying out different methods of light mapping and this is the most helpful tutorial I've seen so far! Thanks!
_________________ Project: Armada - Galactic War | Games Released: Leaf Bound
Web: Pixel Stream |
|
| Back to top |
|
|
designtek

Joined: 14 Mar 2009 Posts: 136 Location: San Diego, CA
|
Posted: Sat Sep 26, 2009 1:03 am Post subject: |
|
|
|
I just tried a test. For some reason I can't get all of the sub materials to export. It only exports as one. I used the multi/sub object material with 2 materials
*EDIT
I got it.
Before I was setting each object on its own g-buffer channel. Didn't work.
I combined everything into one mesh and selected each face and applied "material modifier" to it and set the material id from there.
When I exported I got individual materials.
Now the walk through will make more sense =d
_________________ Project: Armada - Galactic War | Games Released: Leaf Bound
Web: Pixel Stream |
|
| Back to top |
|
|
3dmaxter

Joined: 16 May 2009 Posts: 3 Location: Bandung. Indonesia
|
Posted: Tue Jan 12, 2010 6:34 pm Post subject: |
|
|
|
sorry i haven't online much, can you describe the problem? or can you upload the max file again? it's seems the link is not working. I presume your secondary uv is not render correctly.
| designtek wrote: | I just tried a test. For some reason I can't get all of the sub materials to export. It only exports as one. I used the multi/sub object material with 2 materials
*EDIT
I got it.
Before I was setting each object on its own g-buffer channel. Didn't work.
I combined everything into one mesh and selected each face and applied "material modifier" to it and set the material id from there.
When I exported I got individual materials.
Now the walk through will make more sense =d |
Sometimes different model needs different approach. Like when you share same texture on different material, you are most likely to choose "Material Generation - Per Material". An object with lightmap is more likely using "Per Material" setting.
_________________ Artist should always remember the technical boundaries.
http://wicak3dan.wordpress.com |
|
| Back to top |
|
|
designtek

Joined: 14 Mar 2009 Posts: 136 Location: San Diego, CA
|
|
| Back to top |
|
|
spoof
Joined: 14 Feb 2010 Posts: 9 Location: dublin, ireland
|
|
| Back to top |
|
|
Sinnlos

Joined: 23 Mar 2009 Posts: 21 Location: Switzerland
|
Posted: Tue May 25, 2010 12:12 pm Post subject: |
|
|
|
i've got one question:
why do you add a second map channel?
it has the same information like the first, so why have two?
cheers
_________________ www.roxxor.ch |
|
| Back to top |
|
|
Bryan A
Joined: 09 Feb 2010 Posts: 28
|
Posted: Wed May 26, 2010 1:50 am Post subject: |
|
|
|
Because that's how Lightmap shader in Unity works. It detects the second UV channel as the model Lightmap UV coordinate. No need to properly Unwarp the model nicely for the Lightmap channel. A good flatten UV would suffice.
Nice tutorial by the way.
_________________ Less talk more work!! |
|
| Back to top |
|
|
Marv34

Joined: 07 May 2010 Posts: 4
|
Posted: Sat May 29, 2010 1:40 am Post subject: |
|
|
|
Hey thanks for the some of these work arounds. I'm having an issue with Light maps trying to reuse each other. Say I have a couch with Brass legs and then a Brass Railing. I can get the diffuse mapping to work correct, but when I go to apply the individual light maps, It will use the either the rail light map on both Couch brass leg and Brass hand railing...is there a way to fix this. Maybe something I'm missing here.
|
|
| Back to top |
|
|
badoli
Joined: 11 Aug 2009 Posts: 4 Location: Graz, Austria
|
Posted: Mon Jun 21, 2010 12:07 pm Post subject: |
|
|
|
Hey, i tried that workflow, but for some reason i just don't get the same results. The FBX i export from 3D Studio Max isn't imported into unity the way i intended. Unity seems to ignore the second UV-Set, the one for the lightmaps. I checked the FBX-Files, when i export them as ASCII, they contain the second UV-Set and 3D Studio Max also imports it the correct way again. Yet in Unity it turns out wrong!
Here the Model in Max:
This is it with only the lightmap:
In a quick render, you can see that everything is working in Max:
But imported into Unity, it is broken:
In this excerpt of the ASCII-FBX, you can see that the uv-set is properly exported (i tried binary aswell as ASCII, nothing works!):
| Code: | Texture: "Texture::windowFramePainted_DIF", "" {
Type: "TextureVideoClip"
Version: 202
TextureName: "Texture::windowFramePainted_DIF"
Properties60: {
Property: "TextureTypeUse", "enum", "",0
Property: "Texture alpha", "Number", "A+",1
Property: "CurrentMappingType", "enum", "",0
Property: "WrapModeU", "enum", "",0
Property: "WrapModeV", "enum", "",0
Property: "UVSwap", "bool", "",0
Property: "Translation", "Vector", "A+",0,0,0
Property: "Rotation", "Vector", "A+",0,0,0
Property: "Scaling", "Vector", "A+",1,1,1
Property: "TextureRotationPivot", "Vector3D", "",0,0,0
Property: "TextureScalingPivot", "Vector3D", "",0,0,0
Property: "UseMaterial", "bool", "",1
Property: "UseMipMap", "bool", "",0
Property: "CurrentTextureBlendMode", "enum", "",1
Property: "UVSet", "KString", "", "UVChannel_1"
}
Media: "Video::windowFramePainted_DIF"
FileName: "G:\Projects\Unity\textures\windowFramePainted.tga"
RelativeFilename: "windowFramePainted.tga"
ModelUVTranslation: 0,0
ModelUVScaling: 1,1
Texture_Alpha_Source: "None"
Cropping: 0,0,0,0
}
Texture: "Texture::cafeOstfluegel_LM_I", "" {
Type: "TextureVideoClip"
Version: 202
TextureName: "Texture::cafeOstfluegel_LM_I"
Properties60: {
Property: "TextureTypeUse", "enum", "",0
Property: "Texture alpha", "Number", "A+",1
Property: "CurrentMappingType", "enum", "",0
Property: "WrapModeU", "enum", "",0
Property: "WrapModeV", "enum", "",0
Property: "UVSwap", "bool", "",0
Property: "Translation", "Vector", "A+",0,0,0
Property: "Rotation", "Vector", "A+",0,0,0
Property: "Scaling", "Vector", "A+",1,1,1
Property: "TextureRotationPivot", "Vector3D", "",0,0,0
Property: "TextureScalingPivot", "Vector3D", "",0,0,0
Property: "UseMaterial", "bool", "",1
Property: "UseMipMap", "bool", "",0
Property: "CurrentTextureBlendMode", "enum", "",1
Property: "UVSet", "KString", "", "UVChannel_2"
}
Media: "Video::cafeOstfluegel_LM_I"
FileName: "G:\Projects\Unity\textures\cafeOstfluegel_LM.tga"
RelativeFilename: "cafeOstfluegel_LM.tga"
ModelUVTranslation: 0,0
ModelUVScaling: 1,1
Texture_Alpha_Source: "None"
Cropping: 0,0,0,0
} |
What am i doing wrong...?!
|
|
| Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|