DirectX Raytracing 入门指南
1. 编译着色器
在进行光线追踪之前,需要先编译光线追踪着色器。以下是编译着色器的代码示例:
// Get the shader bytecode result.
result->GetResult(blob);
// Compiled shader DXIL bytecode
IDxcBlob *rgsBytecode, *missBytecode, *chsBytecode, *ahsBytecode;
// Call our helper function to compile the ray tracing shaders.
CompileShader(library, compiler, L"RayGen.hlsl", &rgsBytecode);
CompileShader(library, compiler, L"Miss.hlsl", &missBytecode);
CompileShader(library, compiler, L"ClosestHit.hlsl", &chsBytecode);
CompileShader(library, compiler, L"AnyHit.hlsl", &ahsBytecode);
上述代码中,首先获取着色器字节码结果,然后定义了编译后的着色器DXIL字节码指针,最后调用 CompileShader 函数编译不同类型的光线追踪着色器。
2. 光线追踪管线状态对象(RTPSO)
由于光线可
超级会员免费看
订阅专栏 解锁全文
4012

被折叠的 条评论
为什么被折叠?



