2. 基本概念和定义
2.1. Program
In NVIDIA OptiX 7, a program is a block of executable code on the GPU that represents a particular shading operation. This is called a shader in DXR and Vulkan. For consistency with prior versions of NVIDIA OptiX 7, the term program is used in the current documentation. This term also serves as a reminder that these blocks of executable code are programmable components in the system that can do more than shading. See “Program input”.
在NVIDIA OptiX7中,一个程序(program)是一个GPU上的运行块(a block of exec code),代表了一个特定的着色操作。在DXR和Vulkan中,这称为着色器。为了与NVIDIA OptiX 7的早期版本保持一致,当前文档中依然使用了该叫法:程序。这个叫法还提醒我们,这些可执行代码块是系统中的可编程组件,而非仅是可以执行着色操作。 请参阅“Program input”。
2.2. Program and data model
NVIDIA OptiX 7 implements a single-ray programming model with ray generation, any-hit, closest-hit, miss and intersection programs.The ray tracing pipeline provided by NVIDIA OptiX 7 is implemented by eight types of programs:
NVIDIA OptiX 7实现了单光线(single-ray)编程模型。该模型具有光线生成(ray generation),任意命中(any-hit),最近命中(closest-hit),错过(miss)和相交(intersection)程序。NVIDIA OptiX 7提供的光线跟踪流程由八种程序(program)实现:
Ray generation
The entry point into the ray tracing pipeline, invoked by the system in parallel for each pixel, sample, or other user-defined work assignment. See “Ray generation launches”.
光线追踪流程的入口点,由系统针对每个像素,采样(sample)或其他用户定义的工作分配并行调用。 请参阅“Ray generation launches”。
Intersection
Implements a ray-primitive intersection test, invoked during traversal. See “Traversing the scene graph” and “Ray information”.
实现了在遍历过程中调用的光线原始相交(ray-primitive intersection test)。 请参见“Traversing the scene graph”和“Ray information”。
Any-hit
Called when a traced ray finds a new, potentially closest, intersection point, such as for shadow computation. See “Ray information”.
该程序会在 被追踪的光线 发现了一个新的可能最近相交点时调用,如阴影计算。请参阅“Ray information”。
Closest-hit
Called when a traced ray finds the closest intersection point, such as for material shading. See “Constructing a path tracer”.
该程序会在 被追踪的光线 发现了一个最近的相交点时调用,如材料着色(material shading)。请参阅“Constructing a path tracer”。
Miss
Called when a traced ray misses all scen