实现《火炬之光》中的遮挡效果

本文介绍了一种简化版的《火炬之光》遮挡效果实现方案。该方案仅需一种特殊材质,无需修改现有程序代码。通过调整材质参数,如纹理映射和混合模式,实现了高效且资源占用少的效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

网上有几个高手实现了《火炬之光》里的遮挡效果。
我看了一下,大受启发。
但是比如这篇 http://blog.youkuaiyun.com/nuiuyi/article/details/5293116使用了两个Entity。资源多少有些浪费。
这篇 http://blog.youkuaiyun.com/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
}
}
}
}


效果:




鼓掌。
网上有几个高手实现了《火炬之光》里的遮挡效果。
我看了一下,大受启发。
但是比如这篇 http://blog.youkuaiyun.com/nuiuyi/article/details/5293116使用了两个Entity。资源多少有些浪费。
这篇 http://blog.youkuaiyun.com/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
}
}
}
}


效果:




鼓掌。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值