Ray Shader Table 更新(マテリアル情報など) class DxrScene // GPU Buffer class GpuBuffer; // Scene class DxrScene : public YourGraphics::Scene { public: std::vector<D3D12_RAYTRACING_AABB> m_proceduralGeometryArray; GpuBuffer m_proceduralGeometryBuffer; public: void Build(); }; // main.cpp, シーン 構築 void BuildScene(DxrScene& outScene) { // Sphere Procedural Geometry 構築(AABB) auto CreateSphere = [&](auto& center, auto radius) { return D3D12_RAYTRACING_AABB{ center.x - radius, center.y - radius, center.z - radius, center.x + radius, center.y + radius, center.z + radius, }; }; // Sphere を Procedural Geometry で構築する outScene.m_proceduralGeometryArray.push_back(CreateSphere(Float3(0.0f, 0.0f, -1.0f), 0.25f)); outScene.m_proceduralGeometryArray.push_back(CreateSphere(Float3(0.0f, -100.5f, -1.0f), 100.0f)); outScene.m_proceduralGeometryArray.push_back(CreateSphere(Float3(0.5f, -0.25f, -1.0f), 0.25f)); outScene.m_proceduralGeometryArray.push_back(CreateSphere(Float3(-0.5f, -0.25f, -1.0f), 0.25f)); outScene.m_proceduralGeometryArray.push_back(CreateSphere(Float3(0.0f, 0.0f, -1.5f), 0.25f)); outScene.m_proceduralGeometryArray.push_back(CreateSphere(Float3(0.5f, -0.25f, -1.5f), 0.25f)); outScene.m_proceduralGeometryArray.push_back(CreateSphere(Float3((-0.5f, 0.25f, -1.5f), 0.25f)); // GPU VRAM に Sphere 情報を Structured Buffer としてアップロード outScene.Build(); } CG 技術の実装と数理 2018 Shinya Morishige 2018