找回密码
 立即注册
查看: 4211|回复: 89

[特效Shader] Unity3D使用烘焙贴图小教程

[复制链接]
发表于 2012-12-16 15:01 | 显示全部楼层 |阅读模式
资源信息 Tutorial Information
教程名称: Unity3D使用烘焙贴图小教程(发帖教程)
适用引擎:   (适用引擎,为空默认为Unity)
教程语种: English
教程等级: 1
教程格式: 图文(请用IE9以上浏览器访问本版块)
教程作者: 转载自互联网 (如有问题请短消息联系作者或发表回复)
下载地址: (兑换积分)
点击查看原图
美丽分割线

关于灯光贴图,烘焙贴图如何在unity3d中导入及使用的基本教程。很不错。

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..!!!

第二部分

"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.


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×

评分

参与人数 1鲜花 +1 收起 理由
hunt1727 + 1 赞一个!

查看全部评分

发表于 2012-12-17 13:04 | 显示全部楼层
呵呵 谢谢分享 学习学习
发表于 2012-12-17 19:28 | 显示全部楼层
学习一下,谢谢分享!!{:5_397:}
发表于 2013-1-24 14:06 | 显示全部楼层
哈哈室内的高手啊
发表于 2014-11-4 17:06 | 显示全部楼层
很好的教程学习了!~
发表于 2017-2-24 13:31 | 显示全部楼层
很不错
发表于 2017-2-24 13:37 | 显示全部楼层
楼主是超人
发表于 2017-2-24 13:56 | 显示全部楼层
真心顶
发表于 2017-2-24 13:28 | 显示全部楼层
说的非常好
发表于 2017-2-24 14:27 | 显示全部楼层
不错不错
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Unity开发者联盟 ( 粤ICP备20003399号 )

GMT+8, 2024-4-28 22:54 , Processed in 0.265254 second(s), 32 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表