Optix7文档阅读(二):基本概念

article/2025/11/9 13:13:54

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 scene geometry. See “Constructing a path tracer”.
该程序会在 被追踪的光线 错过(miss)了场景中所有的几何体时调用。 请参阅“Constructing a path tracer”。

Exception
Exception handler, invoked for conditions such as stack overflow and other errors. See “Exceptions”.
异常处理程序,在发生诸如堆栈溢出和其他错误时调用。请参阅“Exceptions”。

Direct callables
Similar to a regular CUDA function call, direct callables are called immediately. See “Callables”.
与常规的CUDA函数调用类似,直接可调用对象将立即被调用。 请参阅“Callables”。

Continuation callables
Unlike direct callables, continuation callables are executed by the scheduler. See “Callables”.
与直接可调用程序不同,连续可调用程序由调度程序(scheduler)执行。 请参阅“Callables”。

The ray-tracing “pipeline” is based on the interconnected calling structure of the eight programs and their relationship to the search through the geometric data in the scene, called a traversal. Figure 2.1 is a diagram of these relationships:
光线追踪流程是基于八个程序的互连调用以及它们与场景中几何数据的搜索关系(称为遍历)。 图2.1是关系示意图:

在这里插入图片描述

In Figure 2.1, green represents fixed-function, hardware-accelerated operations, while gray represents user programs. The built-in or user-provided exception program may be called from any program or scene traversal in case of an exception if exceptions are enabled.
在图2.1中,绿色表示由硬件加速(hardware-accelerated)的固定功能(fixed-function)的操作,而灰色表示用户程序。 如果启用了异常(exception),则在发生异常的情况下,可以从任何程序或场景遍历中调用内置的或由用户提供的异常处理程序(exception program)。

2.2.1. Shader binding table

The shader binding table connects geometric data to programs and their parameters. A record is a component of the shader binding table that is selected during execution by using offsets specified when acceleration structures are created and at runtime. A record contains two data regions, header and data.
着色器绑定表(shader binding table)将几何数据和程序及其参数链接起来。 一个记录(record)是着色器绑定表的组成部分。在执行过程中,将使用创建加速结构时和运行时指定的偏移量(offset)来选择记录(还是着色器绑定表?)。 一条记录包含两个数据区域,标头(header)和数据(data)。

Record header

  • Opaque to the application, filled in by optixSbtRecordPackHeader
  • 对应用不可见,由optixSbtRecordPackHeader写入。
  • Used by NVIDIA OptiX 7 to identify programmatic behavior. For example, a primitive would identify the intersection, any-hit, and closest-hit behavior for that primitive in the header.
  • 由NVIDIA OptiX 7来指定编程行为。例如,一个图元(primitive)将会在header中标识该图元的交集,任何命中和最近命中的行为。

Record data

  • Opaque to NVIDIA OptiX 7
  • 对NVIDIA OptiX 7不可见
  • User data associated with the primitive or programs referenced in the headers can be stored here, for example, program parameter values.
  • 可以在此处存储在标头中引用的与图元或程序相关联的用户数据,例如程序参数值。

2.2.2. Ray payload

The ray payload is used to pass data between optixTrace and the programs invoked during ray traversal. Payload values are passed to and returned from optixTrace, and follow a copy-in/copy-out semantic. There is a limited number of payload values, but one or more of these values can also be a pointer to stack-based local memory, or application-managed global memory.
光线的有效载荷用于在optixTrace和光线遍历期间调用的程序之间传递数据。 有效负载值传递给optixTrace并从中返回,并遵循copy-in/copy-out的语义(semantic)。 有效负载值的数量有限,但是这些值中的一个或多个也可以是指向基于堆栈的本地内存或由应用程序管理的全局内存的指针。

2.2.3. Primitive attributes

Attributes are used to pass data from intersection programs to the any-hit and closest-hit programs. Triangle intersection provides two predefined attributes for the barycentric coordinates (U,V). User-defined intersections can define a limited number of other attributes that are specific to those primitives.
属性(attribute)用于将数据从相交程序(intersection program)传递到any-hit和closest-hit的程序中。 三角形相交为重心坐标(U,V)提供了两个预定义的属性。用户定义的相交可以定义有限数量的其他特定于这些图元的属性。

2.2.4. Buffer

NVIDIA OptiX 7 represents GPU information with a pointer to GPU memory. References to the term “buffer” in this document refer to this GPU memory pointer and the associated memory contents. Unlike NVIDIA OptiX 6, the allocation and transfer of buffers is explicitly controlled by user code.
NVIDIA OptiX 7通过指向GPU内存的指针来表示GPU信息。 本文档中,对“缓冲区”的引用是指此GPU内存指针和其关联的内存内容。 与NVIDIA OptiX 6不同,缓冲区的分配和传输由用户代码明确控制。

2.3. Acceleration structures

NVIDIA OptiX 7 acceleration structures are opaque data structures built on the device. Typically, they are based on the bounding volume hierarchy model, but implementations and the data layout of these structures may vary from one GPU architecture to another.

NVIDIA OptiX 7 provides two basic types of acceleration structures:

Geometry acceleration structures

  • Built over primitives (triangles, curves, or user-defined primitives)
    Instance acceleration structures
  • Built over other objects such as acceleration structures (either type) or motion transform nodes
  • Allow for instancing with a per-instance static transform

NVIDIA OptiX 7 加速结构是设备上构建的不透明数据结构。 通常,它们基于边界体积层次模型(bounding volume hierarchy model),但是这些结构的实现和数据布局可能因一个GPU架构而异。

NVIDIA OptiX 7提供两种基本类型的加速结构:

  • 几何(Geometry)加速结构
    • 建立在图元上(三角形,曲线或用户定义的基本体)
  • 实例(Instance)加速结构
    • 建立在其他对象上,例如加速结构(类型)或运动变换节点(
    • 允许预实例静态转换(per-instance static transform)的实例化(

2.4. Traversing the scene graph

To determine the intersection of geometric data by a ray, NVIDIA OptiX 7 searches a graph of nodes composed of acceleration structures and transformations. This search is called a traversal; the nodes in the graph are called traversable objects or traversables.

NVIDIA OptiX 7通过搜索由加速结构和变换(transformations)组成的节点图以确定几何数据和光线的相交点。这个搜索过程被称为遍历(traversal);在图中的节点被称为可遍历对象或traversables。

Traversable objects consist of the two acceleration structure types and three types of transformations:

  • An instance acceleration structure
  • A geometry acceleration structure (as a root for graph with a single geometry acceleration structure (see “Traversal of a single geometry acceleration structure”)
  • Static transform
  • Matrix motion transform
  • Scaling, rotation, translation (SRT) motion transform

The two motion transformations provide the required positional information for dynamic transformations used in motion blur calculation. Dynamic and static transformations can be combined in a graph. For example, Figure 2.2 combines both types:

可遍历对象包括两个加速结构类型和三种转换类型:

  • 一个实例加速结构
  • 一个几何加速结构(作为具有单个几何加速结构的图的根(请参阅“单个几何加速结构的遍历”))
  • 静态变换
  • 矩阵运动变换
  • 缩放,旋转,平移(即SRT)运动变换

这两个运动转换为在运动模糊计算中使用的动态转换提供了所需的位置信息。 动态和静态转换可以组合在图中。 例如,图2.2结合了两种类型:
在这里插入图片描述
Traversable handles are 64-bit opaque values that are generated from device memory pointers for the graph objects. The handles identify the connectivity of these objects. All calls to optixTrace begin at a traversable handle.

可遍历句柄(traversable handles)是由对图形对象的设备内存指针生成的64位大小的不透明值。 句柄标识这些对象的连通性。 所有对optixTrace的调用均始于可遍历的句柄。

2.5. Ray tracing with NVIDIA OptiX 7

A functional ray tracing system is implemented by combining four components as described in the following steps:

  1. Create one or more acceleration structures that represent a geometry mesh in the scene and select one or more records in the shader binding table for each mesh. See “Acceleration structures”.
  2. Create a pipeline of programs that contains all programs that will be invoked during a ray tracing launch. See “Program pipeline creation”.
  3. Create a shader binding table that includes references to these programs and their parameters. See “Shader binding table”.
  4. Launch a device-side kernel that will invoke a ray generation program with a multitude of threads calling optixTrace to begin traversal and the execution of the other programs. See “Ray generation launches”. Device-side functionality is described in “Device-side functions”.

Ray tracing work can be interleaved with other CUDA work to generate data, move data to and from the device, and move data to other graphics APIs. It is the application’s responsibility to coordinate all work on the GPU. NVIDIA OptiX 7 does not synchronize with any other work.

通过结合以下步骤中描述的四个组件来实现光线追踪系统:

  1. 创建一个或多个表示场景中几何网格(geometry mesh)(是否可以把这个网格理解为模型(model))的加速结构,并在着色器绑定表中为每个网格选择一个或多个记录。请参阅“Acceleration structures”。
  2. 创建一个程序管道(pipeline of program),其中包含在光线追踪启动(ray tracing launch)期间将被调用的所有程序。请参阅“Program pipeline creation”。
  3. 创建一个着色器绑定表,其中包含对这些程序及其参数的引用。请参见“Shader binding table”。
  4. 启动设备端内核,该内核将调用带有optixTrace的多个线程的光线生成程序,以开始遍历和执行其他程序。请参阅“Ray generation launches”。设备端功能在“Device-side functions”中介绍。

光线跟踪工作可以与其他CUDA工作交错在一起以生成数据,在设备之间来回移动数据以及将数据移动到其他图形API。协调GPU上的所有工作是应用程序的责任。 NVIDIA OptiX 7不与任何其他作品同步。


http://chatgpt.dhexx.cn/article/aJFT4719.shtml

相关文章

初次尝试OpitX +CMake

** 初次尝试OptiX CMake ** 首先安装好cuda、vs、OptiX和CMake 在OptiX的SDK文件(C:\ProgramData\NVIDIA Corporation\OptiX SDK 7.1.0\SDK)中找到CMakeLists.txt ,将其拖入CMake中,在CMake点击Configure ,完成后点…

Instant-ngp Windows11安装、使用记录

Instant NeRF - Study&Debug 本机配置 Y9000P RTX3060 Win11 Instant NeRF - Study&Debug1. Git2. Cmake3. instant-ngp示例数据自定义数据注意事项问题疑惑 1. Git 正常下载安装,启动Git Bash 设置用户名 $ git config --global user.name "**&q…

Houdini17 OptiX Denoise使用

Houdini17 OptiX Denoise使用 NVIDIA Optx Denoiser第一步 下载安装第二步 启用第三步 打开面板中的按钮一句卧槽走天下! NVIDIA Optx Denoiser NVIDIA Optx Denoiser是一个后处理的算法,在Houdini17中可以被开启使用 第一步 下载安装 点击 Render/ D…

HTML中option和input的区别,option

手机评站网今天精心准备的是《option》,下面是详解! option键是哪一个? 我的键盘上没有option字样的键,请问它指的是哪一个??... 我的键盘上没有option字样的键,请问它指的是哪一个?…

十四、OPTIM

一、torch.optim torch.optim.Optimizer(params, defaults)优化器官网说明 由官网给的使用说明打开看出来优化器实验步骤: ①构造选择优化器 例如采用随机梯度下降优化器SGD torch.optim.SGD(beyond.parameters(),lr0.01),放入beyond模型的参数param…

GPU开发环境搭建(CUDA和 OptiX)

Optix是英伟达一直推出的闭源光线跟踪(rayTracing)引擎 CUDA(Compute Unified Device Architecture),是显卡厂商NVIDIA推出的运算平台。 CUDA™是一种由NVIDIA推出的通用并行计算架构,该架构使GPU能够解决复…

Intel OpenImageDenoise VS Nvidia Optix 降噪结果对比

说明:原始图像(Raytracing的直接输出结果,每一幅的左图)为PPM格式, 一、OIDN 按照官方文档提示,先用ImageMagick转换成pfm格式,再将其作为oidn的输入,输出亦为pfm。 magick conve…

OTN技术及华为OTN设备简介

OTN技术及华为OTN设备简介 城域波分环四环五即将进行建设,本次工程采用华为华为下一代智能光传送平台OTN设备OptiX OSN 8800和OptiX OSN 6800。本文主要对OTN技术涉及的网络结构、复用方式、帧结构、ROADM技术和OptiX OSN 8800和OptiX OSN 6800设备特点及本次工程配…

【OptiX】第0个示例 OptixHello 学习Optix的工程配置以及基本框架

首先需要查看本博客的这篇文章:【Optix】Optix介绍与示例编译 把该安装的工程都安装好。可以按照本文所说的顺序创建和理解代码,也可以在本文末尾下载到已经配置好的代码。建议首先在本文末尾处下载代码,编译通过,这样配合文件看心…

OptiX-7入门教程

OptiX是英伟达专为光线追踪打造的SDK,但是他的官方案例都比较复杂,包含了大量初始化相关的代码,初学容易一头雾水。 本人跟着Github上的optiX7course一步步学习才算入门。这个课程是Siggraph 2019/2020上的OptiX课程,有源码&…

optix入门

射线追踪是embarrassingly parallel/perfectly parallel/pleasingly parallel的问题,就是说基本不用费劲就可以并行化。 射线追踪是指从某点发射射线,判断其与几何结构的交点,根据交点对图像进行渲染,或者计算。 nvidia optix是基…

jwt *

目录 一、jwt出现的原因及工作原理 1. JWT是什么 2. 为什么使用JWT 3. JWT的工作原理 4、jwt解决不需要登录就能直接访问的问题: 解决登录后树形菜单未出现的问题 : 二、jwt工具类介绍,三种场景 1、jwt工具类 2、三种场景 三、jwt…

JWT JWT

JWT(JSON WEB TOKEN) JWT的组成 header(头部):中主要存储了两个字段 alg,typ。 alg表示加密的算法默认(HMAC SHA256),typ表示这个令牌的类型默认为JWT。 payload&#…

JWT__

文章目录 JWT什么是JWT?JWT能做什么?认证流程JWT的结构是什么?使用代码要做一个JWT的例子引入pom依赖生成一个Token令牌验证令牌并从令牌中取出信息 JWT 什么是JWT? 官网地址:https://jwt.io/introduction/ 官方文档 JSON Web T…

JWT 和 JJWT 还傻傻的分不清吗

JWTs是JSON对象的编码表示。JSON对象由零或多个名称/值对组成,其中名称为字符串,值为任意JSON值。 JWT有助于在clear(例如在URL中)发送这样的信息,可以被信任为不可读(即加密的)、不可修改的(即签名)和URL - safe(即Base64编码的)。 JSON W…

【编码实战】2022年还在用jjwt操作jwt?,推荐你使用nimbus-jose-jwt,爽到飞起~

什么是nimbus-jose-jwt? nimbus-jose-jwt是基于Apache2.0开源协议的JWT开源库,支持所有的签名(JWS)和加密(JWE)算法。 对于JWT、JWS、JWE介绍 JWT是一种规范,它强调了两个组织之间传递安全的信息JWS是JWT的一种实现,包含三部分hea…

什么是JWT??

一、什么是JWT JWT(JSON WEB TOKEN),通过数字签名的方式,以json对象为载体,在不同的服务终端之间安全的传输信息,用来解决传统session的弊端。 JWT在前后端分离系统,或跨平台系统中,通过JSON形式作为WEB应用…

JJWT实现令牌Token

登录实现方式 Session 详情: https://www.cnblogs.com/andy-zhou/p/5360107.html 会话的概念 会话就好比打电话,一次通话可以理解为一次会话。我们登录一个网站,在一个网站上不同的页面浏览,最后退出这个网站,也是…

3.JJWT

目录 1.JWT简介 2.JWT的结构 3.基于服务器的传统身份认证 4.基于token的身份认证 5. JWT的优势 6.Java中使用JJWT实现JWT 1.JWT简介 Json web token (JWT), 是为了在网络应用环境间传递声明而执行的一种基于JSON的开放标准(RFC 7519)。该token被设计为紧凑且安全的…

JWT技术

JWT 一、 JWT 实现无状态 Web 服务 1、什么是有状态 有状态服务,即服务端需要记录每次会话的客户端信息,从而识别客户端身份,根据用户身份进行请求的处理,典型的设计如tomcat中的session。 例如登录:用户登录后&am…