物件的边缘高亮(Entity edge highlight)

本文探讨了在游戏中实现NPC边缘高亮显示的技术方案,以便玩家能清晰地识别并选择目标NPC。通过调整绘制顺序及深度写入状态,能够简单有效地达到预期效果。

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

原文出处:http://www.cppblog.com/lai3d/archive/2007/11/18/36899.html

在游戏里面鼠标与某个npc相交了后,就让npc的边缘高亮显示或者怎么处理下,让玩家很明确地知道他点下去就能选中此npc。《卓越之剑》有这效果。google了下没找到相关资料。

我在gamedev上的提问:
when the cursor is over an entity, I want to highlight it's edge so that a player can immediately know he can pick this entity after he click the mouse left button. for example, there are many monsters around the main character in the game, it is not easy to pick one monster. I googled this, but found nothing. who can give me some suggestion?


老外的回答:
The simplest method is to draw the object colored in the highlight color, with some scaling to make it larger than the original object. Do this drawing with depth writes turned off. Then, after this, draw the object as usual, with depth writes on again. There are more complex methods, depending on your application - depending on what is your bottleneck, depending on complexity of your monster models etc etc. but the method above is simple to implement and should work for most cases.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值