發表文章

目前顯示的是 12月, 2018的文章

Optix Ray Tracing 基本概念流程

圖片
Optix Ray Tracing 基本概念與流程 Optix 3D幾何物件階層與用途 基本設定設置好 createContext()      建立context,並把該配置的東西配好 => 建立Context => 設定Context的 Ray Type數量 、 Entry Point計算入口點數量 、 stack size大小 => 設定會成為Context的cuda中的一些成員資料 => 建立Output buffer,用以存放ray tracing結果 => 設定Ray Gerneration光線生成程式(也就是描述你的camera要如何生成ray來追蹤) => 設定Exception例外程式 => 設定Miss Program(當光線沒打到任何3D內容物件時會執行miss程式) createGeometry()    建立與設定3D內容與綁定render方法 => 設置好場景中的3D內容物件 (load model或用程式寫好描述好他) => 對場景中每個3D物件客製化一個material材質,因為 光線追蹤程式(rtTrace()) 是綁定material一起的 ,所以要一個個對material做設定 => 對個別3D物件material設定 closeset hit program (常用於上色的光線追蹤) 、 any hit program (常用於陰影追蹤) 等program (*closest hit這些tracing program都寫在cuda之中) => 透過context->createGeometryInstance()將3D物件與他的material綁定在一起,並丟到 GeometryInstance 的vector容器中 => 將每個GeometryInstance集結成一個Group送至 GeometryGroup 物件中(setChild()) => 將這個裝滿整個3D場景的Group送到cuda之中做tracing。 設定相機基本位置角度等資料 設定光源位置 顏色等相關資料,並傳入context context->validate()   使context準備完善 進入render loop =&g