OCCT 6.7.0 introduces several major improvements of the visualization component. One of the most breaking changes in OCCT visualization concerns simplified implementation of ray tracing algorithm for regular OCCT visualization primitives. This algorithm is implemented using OpenCL. Being a part of TKOpenGl library, it is fully integrated with standard OCCT visualization logic. From now on, ray tracing can be used as alternative rendering method instead of OpenGL rasterization. Compared to third-party ray tracing libraries, the built-in implementation ensures real-time rendering performance, which is close to or even better than OpenGL rasterization performance on heavy models.
The simplified - but still powerful! - ray tracer implementation has the following features:
- High-quality shading by interpolating normal across the triangle pixels and using advanced illumination model (Phong shading)
- Depth-correct order-independent transparency for any number of overlapped objects
- Sharp shadows from isotropic point and directional lights without any approximation вЂ“ greatly improve visual appearance
- Specular reflections and environment mapping вЂ“ for high-quality rendering of metallic surfaces
- Low-cost adaptive anti-aliasing allows to improve image quality by removing jagged edges from the image
- Based on cross-platform OpenCL framework вЂ“ runs on GPUs of major vendors (NVIDIA and AMD/ATI)
- Makes the most of the mid-/top-range GPUs but also runs successfully on low-end GPUs that support OpenCL
Once OCCT has been built with OpenCL support, using ray tracing is really simple: it is enough to call V3d_View::SetRaytracingMode() to switch the 3D view to ray tracing rendering. Refer to V3d_View class documentation and check vraytrace and vsetraytracemode DRAW Test Harness commands for details how to adjust ray tracing options. Probably, the easiest way to evaluate ray tracing output is to run the following command from the DRAW command prompt:
Below some snapshots are included that give a basic idea how OCCT ray tracing improves quality of 3D scene rendering. The snapshots were created using CAD models from http://www.grabcad.com/.
The first version of ray tracing algorithm has the following limitations, some or all of them will be addressed in the future OCCT releases:
- Textures are not imported from OCCT visualization data (except for the environment texture which is taken into account)
- Ray tracing component currently supports only polygonal geometry
- Points, lines and text are not supported вЂ“ as a consequence, wireframe presentation cannot be rendered using ray tracing
- Coincident triangles results in visual artifacts (same problem as in case of OpenGL usage)
- The workaround is to shift coincident geometries with respect to each other by a very small value
- Support of CPUs and Intel GPUs is not tested
- Operation under MacOS X is not tested. OCCT users are encouraged to provide their patches related to this platform.
- Source geometry for ray tracing is taken from CPU memory, existing VBO data is not reused by ray tracing
- To enable OpenGL rendering in parallel with ray tracer rendering, VBOs are created without releasing CPU memory occupied by geometrical data
- Non-optimal memory footprint:
- Combined rendering (OpenGL + ray-tracing): 3.3x memory amount used (2.3x on GPU)
- 2 GB GPU memory: up to 30M triangles in ray-tracing mode