网上有几个高手实现了《火炬之光》里的遮挡效果。
我看了一下,大受启发。
但是比如这篇
http://blog.csdn.net/nuiuyi/article/details/5293116使用了两个Entity。资源多少有些浪费。
这篇
http://blog.csdn.net/qq18052887/article/details/6326700复杂到我都不知道他在说什么。
主要在以上二位高手的基础上。我思考了一下。实现了一个目前为止最简单的方案。
如下:要这个材质即可,程序中其他都不需要改变。
material Test/TestTransparent
{
technique
{
pass 0
{
ambient 0.2 0.2 0.2
scene_blend add
depth_write off
depth_func greater
texture_unit
{
texture Water01.jpg
scroll_anim 0.25 0
}
texture_unit
{
texture Water01.jpg
wave_xform scroll_y sine 0 0.1 0 0.5
}
}
pass 1
{
ambient 0.7 0.7 0.7
diffuse 0.7 0.7 0.7
texture_unit
{
texture KAMEN320x240-bump.jpg
}
}
}
}
效果:
鼓掌。