您将如何实现完美的视线算法?
免责声明:我实际上并不是想制作一个,我只是好奇如何做到这一点。
我包括基础知识
- 墙
- 距离
- 光水平
和更复杂的
- 大气中的
- 灰尘雨,雨夹雪,雪
- 云
- 植被
- 烟火
- 当我说“最准确”时,
如果我想对此进行编程,我应该研究哪些资源以及应该做什么我留意吗? 另外,是否有任何有关视线背后理论(包括所有这些变量)的相关书籍?
Disclaimer: I'm not actually trying to make one I'm just curious as to how it could be done.
When I say "Most Accurate" I include the basics
- wall
- distance
- light levels
and the more complicated
- Dust in Atmosphere
- rain, sleet, snow
- clouds
- vegetation
- smoke
- fire
If I were to want to program this, what resources should I look into and what things should I watch out for?
Also, are there any relevant books on the theory behind line of sight including all these variables?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
由于输入没有明确定义,因此没有“单一算法”。
如果您将大气中的灰尘视为一个常数值,那么有一种算法可以将其考虑在内,但事实是灰尘水平会因点而异,因此您想要的算法需要了解如何您的灰尘数据是结构化的。
当今光线追踪器中最常用的算法只是增量光线行进,从定义上来说这是不正确的,但它确实在相当程度上接近最终答案。
即使您设法将所有这些属性合并到一个主算法中,您仍然必须以某种方式处理不同的人如何看待相同的设置。 有的人近视,有的人远视。 然后就是色盲。 更不用说大气中的灰尘水平也会影响泪腺,从而影响能见度。 然后,人们实际看到的内容和他们认为自己看到的内容之间存在着完全的二分法……
这里有太多变量,无法寻求统一的解决方案。 将您的环境视为体素空间并通过它发射光线。 我怀疑这是你一生中能够完成的唯一解决方案......
There is no "one algorithm" for these since the inputs are not well defined.
If you treat Dust-In-Atmosphere as a constant value then there is an algorithm that can take it into account, but the fact is that dust levels will vary from point to point, and thus the algorithm you want needs to be aware of how your dust-data is structured.
The most used algorithm in todays ray-tracers is just incremental ray-marching, which is by definition not correct, but it does approximate the Ultimate Answer to a fair degree.
Even if you managed to incorporate all these properties into a single master-algorithm, you'd still have to somehow deal with how different people perceive the same setting. Some people are near-sighted, some far-sighted. Then there's the colour-blind. Not to mention that Dust-In-Atmosphere levels also affect tear-glands, which in turn affects visibility. And then there's the whole dichotomy between what people are actually seeying and what they think they are seeying...
There are far too many variables here to aim for a unified solution. Treat your environment as a voxelated space and shoot your rays through it. I suspect that's the only solution you'll be able to complete within a single lifetime...
明显的问题是您真的想要最准确的数据吗?为什么?
我曾经开发过依赖视线的游戏,你真的需要清楚地考虑你想要什么样的视线。
首先,人工智能能看到你身体的任何部位吗? 或者你说的是“面对面”LOS?
其次,如果玩家的摄像机视图不是他的化身的眼睛视图,则玩家不会将您的高度准确的视线感知为高度准确。 在这一点上,不准确是可以接受的。
我并不是想劝阻你,但请记住,玩家体验是第一,这可能意味着没有拥有最好的LOS。
我的一个好朋友为一系列长期运行的流行主机游戏开发了人工智能。 他经常讲述一个故事,讲述人工智能在第一款游戏中如何最有趣(和有趣),因为它们会偶然发现你,而不是远远地看到你。 现在,他的 LOS 非常好,并花时间试图让他们变得简单,让他们像第一场比赛一样有趣。
那么你为什么要这样做呢? 游戏需要吗? 或者你只是想接受挑战?
The obvious question is do you really want the most accurate, and why?
I've worked on games that depended on line of sight and you really need to think clearly about what kind of line of sight you want.
First, can the AI see any part of your body? Or are you talking about "eye to eye" LOS?
Second, if the player's camera view is not his avatar's eye view, the player will not perceive your highly accurate LOS as highly accurate. At which point inaccuracies are fine.
I'm not trying to dissuade you, but remember that player experience is #1, and that might mean not having the best LOS.
A good friend of mine has done the AI for a long=-running series of popular console games. He often tells a story about how the AIs are most interesting (and fun) in the first game, because they stumble into you rather than see you from afar. Now, he has great LOS and spends his time trying to dumb them down to make them as fun as they were in the first game.
So why are you doing this? Does the game need it? Or do you just want the challenge?
通常,将世界表示为保存在某种空间分区数据结构中的一组空间体,然后将表示您的“视线”的光线与该结构相交,以找到它击中的一组对象; 然后从光线原点开始按顺序遍历这些以确定总体结果。 反射物体会导致发射更多光线,不透明物体会停止行走,而半透明物体会部分影响结果。
您可能想阅读有关光线追踪的内容; 关于这个主题有大量的文献,并且有很好理解的方法来解决与您列出的存在的基本相同的问题。
Typically, one represents the world as a set of volumes of space held in some kind of space partitioning data structure, then intersects the ray representing your "line of sight" with that structure to find the set of objects it hits; these are then walked in order from ray origin to determine the overall result. Reflective objects cause further rays to be fired, opaque objects stop the walk and semitransparent objects partially contribute to the result.
You might like to read up on ray tracing; there is a great body of literature on the subject and well-understood ways of solving what are basically the same problems you list exist.
我个人对这个主题不太了解,但快速的谷歌搜索发现了一些正式论文,其中包含一些非常相关的信息:
http://www.tecgraf.puc-rio.br/publications/artigo_1999_efficient_lineofsight_algorithms.pdf - 提供有效执行 LOS 计算的两种不同方法的详细描述,以及涉及的问题
http://www.agc.army.mil /operations/programs/LOS/LOS%20Compendium.doc - 该文档旨在维护“当前的独特 LOS 算法列表”; 它有一个部分列出了相当多的内容并详细描述了它们,重点是军事应用。
希望这可以帮助!
I personally don't know too much about this topic but a quick couple of Google searches turns up some formal papers that contain some very relevant information:
http://www.tecgraf.puc-rio.br/publications/artigo_1999_efficient_lineofsight_algorithms.pdf - Provides a detailed description of two different methods of efficiently performing an LOS calculation, along with issues involved
http://www.agc.army.mil/operations/programs/LOS/LOS%20Compendium.doc - This one aims to maintain "a current list of unique LOS algorithms"; it has a section listing quite a few and describing them in detail with a focus on military applications.
Hope this helps!