在 3D 应用程序中绘制目标圆
我正在开发 3d 游戏只是为了学习。
我有一个从高度图生成的 3D 世界,以及覆盖在该世界上的各种基于网格的对象。
我希望玩家能够瞄准我可以做到的世界中的物体,但我想在目标物体所在的地形或物体上绘制一个瞄准圆。如果你玩过魔兽世界,你就会明白我的意思,当你瞄准某人时,它会在他们下面的地板上画一个红色圆圈。
但它会投射到他们所站的任何东西上。这可能是地形 - 因此可能需要投影到具有不同斜率的不同网格多边形上,其中一个圆的一部分和另一个圆的一部分。或者可能需要投影到某个项目上。或者可能一部分在一个上,一部分在另一个上。
有什么想法可以有效地做到这一点吗?作弊和近似也是受欢迎的,像往常一样,在游戏中我正在寻找看起来有效的东西,而不是 100% 正确的东西。
如果这对任何解决方案都很重要,请使用 directx9 和着色器模型 2。
I'm working on a 3d game just for learning.
I have a 3d world generated from a heightmap and various mesh based objects overlayed onto that world.
I want the player to be able to target objects in the world which I can do, but I want to draw a targetting circle on the terrain or object that the targetted thing is standing on. If you've played world of warcraft you'll know what I mean, when you target someone it draws a red circle onto the floor below them.
But it's projected onto whatever they are standing on. Which might be the terrain - and therefore might need projecting onto different mesh polygons with different slopes, part o fthe circle on one and part on the other. Or might need projecting onto an item. Or possibly part on one and part on the other.
Any ideas how to do this efficiently? Cheats and approximations are welcome too, as usual in games I'm looking for something looks effective rather than 100% correctness.
Using directx9 and shader model 2 if that matters at all for any solutions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一种不错的方法是使用光源。简单地说,在你想要突出显示的项目上轻轻一抹,然后让其余的都在阴影中。
计算成本较高,但从编程角度而言,只需使用您选择的 Direct3D 工具包中的光照函数即可。
one nice approach is to use a light-source. Simplistically, shine a touch down onto the item you want to highlight, and let the rest all be in the shade.
Computationally expensive, but programming wise its to just use the lighting functions in your Direct3D tool-kit of choice.