OpenCascade Ray Tracing Rendering
Posted on 2014-01-11 14:36 eryar 閱讀(3021) 評(píng)論(0) 編輯 收藏 引用 所屬分類: 2.OpenCASCADEOpenCascade Ray Tracing Rendering
摘要Abstract:OpenCascade6.7.0中引入了光線跟蹤算法的實(shí)現(xiàn)。使用光線跟蹤算法可實(shí)現(xiàn)高質(zhì)量的渲染效果,且可以使用GPU提升渲染效率。
關(guān)鍵字Key Words:OpenCascade, Ray Tracing
參考鏈接:Ray tracing as alternative rendering method for OCCT visualization component
http://dev.opencascade.org/index.php?q=node/898
OpenCascade 6.7.0對(duì)顯示部分做了些重大改進(jìn),其中突破性的改變是使用OpenCL實(shí)現(xiàn)了光線跟蹤算法。作為庫(kù)TKOpenGl的一部分,光線跟蹤算法與標(biāo)準(zhǔn)的顯示模塊完全集成。從此,光線跟蹤也可以作為顯示的一種方法。與其他第三方庫(kù)的光線跟蹤庫(kù)的區(qū)別是,內(nèi)置的光線跟蹤算法確保了實(shí)時(shí)渲染時(shí)的性能,性能與OpenGL的性能相近,在有大量模型時(shí)性能比OpenGL的還要好。
光線跟蹤功能如下:
l High-quality shading by interpolating normal across the triangle pixels and using advanced illumination model (Phong shading);
l Depth-correct order-independent transparency for any number of overlapped objects;
l Sharp shadows from isotropic point and directional lights without any approximation – greatly improve visual appearance;
l Specular reflections and environment mapping – for high-quality rendering of metallic surfaces;
l Low-cost adaptive anti-aliasing allows to improve image quality by removing jagged edges from the image;
l Based on cross-platform OpenCL framework – runs on GPUs of major vendors (NVIDIA and AMD/ATI);
l Makes the most of the mid-/top-range GPUs but also runs successfully on low-end GPUs that support OpenCL。
只要OpenCascade編譯時(shí)啟用OpenCL支持,光線跟蹤的使用是相當(dāng)簡(jiǎn)單,只需要調(diào)用函數(shù)V3d_View::SetRaytracingMode()就可以把3D view切換成光線跟蹤渲染啦。參考V3d_View和文檔或者Draw Test Harness的vraytrace和vsetraytracemode命令實(shí)現(xiàn)的源程序去詳細(xì)了解如何設(shè)置光線跟蹤的一些選項(xiàng)。
最簡(jiǎn)單的測(cè)試光線跟蹤的方式是在Draw Test Harness中輸入如下命令:
生成效果如下圖所示:
Figure 1.1 Render bottle and text with ray tracing
Figure 1.2 Render pipe and equipment models with ray tracing
Figure 1.3 Render pipe and equipment models with ray tracing
從上圖可知,使用光線跟蹤效果很不錯(cuò),可以看到鏡面效果,很Cool!
PDF Version: OpenCascade Ray Tracing Rendering