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?
如果我想要编程,我应该查看哪些资源以及应该注意哪些事项?此外,是否有关于视线背后理论的相关书籍,包括所有这些变量?
4 个解决方案
#1
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.
您可能希望阅读光线追踪;有很多关于这个主题的文献和很好理解的方法来解决你列出的基本相同的问题。
#2
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.tecgraf.puc-rio.br/publications/artigo_1999_efficient_lineofsight_algorithms.pdf - 提供有效执行LOS计算的两种不同方法的详细说明,以及涉及的问题
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.
http://www.agc.army.mil/operations/programs/LOS/LOS%20Compendium.doc-这个目的是维护“当前唯一的LOS算法列表”;它有一个部分列出了很多,并详细描述了它们,重点是军事应用。
Hope this helps!
希望这可以帮助!
#3
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?
首先,AI可以看到你身体的任何部位吗?或者你在谈论“眼对眼”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.
其次,如果玩家的相机视图不是他的化身的眼睛视图,则玩家将不会将您的高度准确的LOS视为高度准确。在这一点上,不准确是好的。
I'm not trying to dissuade you, but remember that player experience is #1, and that might mean not having the best LOS.
我不是想劝阻你,但要记住玩家的体验是#1,这可能意味着没有最好的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.
我的一个好朋友已经完成了人工智能的一系列 - 令人兴奋的一系列流行的主机游戏。他经常讲述一个关于人工智能在第一场比赛中最有趣(和有趣)的故事,因为他们偶然发现了你,而不是远远地看到你。现在,他有很棒的LOS,并且花时间试图让他们愚蠢到让他们像第一场比赛一样有趣。
So why are you doing this? Does the game need it? Or do you just want the challenge?
那么你为什么要这样做?游戏需要它吗?或者你只是想要挑战?
#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.
由于输入没有很好地定义,因此没有“一种算法”。如果你把Dust-In-Atmosphere视为一个常数值,那么有一种算法可以考虑它,但事实是灰尘级别会因点而异,因此你想要的算法需要知道如何你的尘埃数据是结构化的。
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...
这里有太多的变量可以用于统一解决方案。将您的环境视为一个voxelated空间,并通过它拍摄你的光线。我怀疑这是你能在一生中完成的唯一解决方案......
#1
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.
您可能希望阅读光线追踪;有很多关于这个主题的文献和很好理解的方法来解决你列出的基本相同的问题。
#2
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.tecgraf.puc-rio.br/publications/artigo_1999_efficient_lineofsight_algorithms.pdf - 提供有效执行LOS计算的两种不同方法的详细说明,以及涉及的问题
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.
http://www.agc.army.mil/operations/programs/LOS/LOS%20Compendium.doc-这个目的是维护“当前唯一的LOS算法列表”;它有一个部分列出了很多,并详细描述了它们,重点是军事应用。
Hope this helps!
希望这可以帮助!
#3
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?
首先,AI可以看到你身体的任何部位吗?或者你在谈论“眼对眼”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.
其次,如果玩家的相机视图不是他的化身的眼睛视图,则玩家将不会将您的高度准确的LOS视为高度准确。在这一点上,不准确是好的。
I'm not trying to dissuade you, but remember that player experience is #1, and that might mean not having the best LOS.
我不是想劝阻你,但要记住玩家的体验是#1,这可能意味着没有最好的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.
我的一个好朋友已经完成了人工智能的一系列 - 令人兴奋的一系列流行的主机游戏。他经常讲述一个关于人工智能在第一场比赛中最有趣(和有趣)的故事,因为他们偶然发现了你,而不是远远地看到你。现在,他有很棒的LOS,并且花时间试图让他们愚蠢到让他们像第一场比赛一样有趣。
So why are you doing this? Does the game need it? Or do you just want the challenge?
那么你为什么要这样做?游戏需要它吗?或者你只是想要挑战?
#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.
由于输入没有很好地定义,因此没有“一种算法”。如果你把Dust-In-Atmosphere视为一个常数值,那么有一种算法可以考虑它,但事实是灰尘级别会因点而异,因此你想要的算法需要知道如何你的尘埃数据是结构化的。
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...
这里有太多的变量可以用于统一解决方案。将您的环境视为一个voxelated空间,并通过它拍摄你的光线。我怀疑这是你能在一生中完成的唯一解决方案......