Posted on 2011-07-27 00:37
buf 阅读(1634)
评论(0) 编辑 收藏 引用 所属分类:
Graphics
使用
http://www.ogre3d.org/tikiwiki/Materials#Simple_texture_transition介绍的方法,可以实现简单的纹理混合,其原理是利用一张灰度图像为蒙板,并在材质脚本中为各层纹理设置相应的属性实现的。最终效果如下:

由下往上三层纹理图片分别为:



green.jpg Untitled-2.png dirt.jpg
相应的材质脚本为:
material ground
{
technique
{
pass
{
texture_unit
{
texture green.jpg
scale .2 .2
}
texture_unit
{
texture Untitled-2.png
colour_op alpha_blend
}
texture_unit
{
texture dirt.jpg
scale .2 .2
colour_op_ex blend_current_alpha src_texture src_current
}
}
}
}
其中,Untitled-2.png为8bit灰度图像,在ps中打开后是这样子:

在ps中创建蒙板时,注意将背景色设置为透明:

在ps中也可以增加alpha通道,但试过发现无法设置其背景色为透明,因此也无法进一步制作蒙板。