RT核心 是一件硬件 NVIDIA公司 从RTX 2000系列的 显卡 ,其主要工作是加快 光线追踪 ,但与此同时,效率却几乎是神秘的。 What is this piece of hardware and how does it work?这是什么硬件,它如何工作? What advantages does it bring?它带来什么好处? We explain it to you quickly and easily.我们会快速,轻松地向您解释。
RT Cores的工作非常简单,它们负责计算光线与场景中的对象之间发生的交点,但是此定义太简单了,无法解释该硬件执行的整个过程。 But before we move on to talking about the RT Cores, let's start at the beginning.但是在继续讨论RT内核之前,让我们从头开始。
什么是光线追踪?
光线追踪是一项技术,其操作基于场景中的对象来追踪场景中的光线。
首先执行的光线是所谓的“主光线”(primaryray)或更好的“眼睛光线”或“相机 射线”; 这些功能用于检查场景的可见性,即从相机的角度(用户的角度)可以看到哪些对象。 问题在于,算法的最原始形式迫使我们不得不从相机向场景中的每个像素发射光线,这是非常低效的,这就是为什么要使用更简单的机制的原因。
边界体积层次结构,场景优化
最好的办法是在空间数据结构中组织场景的几何形状,这将有助于我们加快处理速度,当今最常用的一种就是所谓的“边界体积层次”(Bounding Volume Hierarchy,BVH)。
想法是获得一张三维图,以了解当前帧中场景中几何的组织方式:
它以树的形式组织:
The objects marked with numbers are the boxes that contain other boxes and the triangles that make up the 3D geometry of the scene.标有数字的对象是包含其他框的框以及构成场景XNUMXD几何形状的三角形。 Triangles are always at the last level of the binary tree.三角形始终位于二叉树的最后一级。 In the example they are marked with letters to better identify them and differentiate them from the boxes.在示例中,它们用字母标记,以更好地识别它们并将它们与框区分。
The BVH of the scene is created taking into account the position of the objects with respect to the camera, however, other BVH can be created in relation to the indirect rays, product of the bouncing of the light on an object.场景的BVH是在考虑对象相对于摄像机的位置的情况下创建的,但是,也可以相对于间接光线(对象上的光反射)生成其他BVH。 In that case, another BVH will be created in which the BVH will be reorganized taking the object that creates the indirect ray as the point of origin.在这种情况下,将创建另一个BVH,在其中将重组BVH,将创建间接射线的对象作为原点。
RT Cores功能
。
为了更好地可视化它,以上面的树为例,RT Core会经过以下路径:
- 1→3→一个
- 1→3→b
- 1→3→c
- 1→2→4→d
- 1→2→4→e
- 1→2→5→f
- 1→2→5→克
However, depending on the type of node of the tree in which the RT Core is located when navigating the scene, depending on whether it is a box or a primitive, an intersection calculation or another will be applied.但是,根据在场景导航时RT Core所在的树的节点类型,取决于它是盒子还是图元,将应用相交计算或其他方法。 That is why RT Cores have two types of units to calculate the intersection: one for the boxes, which is much simpler, and another for the primitives.这就是为什么RT Core具有两种类型的单位来计算交集的原因:一种用于盒子,这要简单得多,而另一种用于图元。
Actually, for ray tracing, only the intersection between the ray and the primitive / object matters, since the boxes are only a way to organize the geometry of the scene.实际上,对于光线跟踪,仅光线与图元/对象之间的交点很重要,因为框只是组织场景几何形状的一种方法。 It is precisely the intersection with ray / primitive that will inform the type of intersection that the ray has produced with the object and what type of Shader will be executed to manipulate the visual properties of the object, although it is true that this is not the work of RT Core , since it simply informs if there is an intersection or not and in what way, so its work is limited to that task.恰好是与射线/图元的交点会通知射线与对象产生的交点类型以及将执行哪种类型的着色器以操纵对象的视觉属性,尽管的确不是这样。 RT Core的工作,因为它只是告知是否有交叉路口以及以什么方式通知,因此其工作仅限于该任务。