Embree High Performance Ray Tracing Kernels 3.13.1
Total Page:16
File Type:pdf, Size:1020Kb
Intel® Embree High Performance Ray Tracing Kernels 3.13.1 August 10, 2021 Contents 1 Embree Overview 2 1.1 Supported Platforms ......................... 3 1.2 Version History ............................ 3 2 Installation of Embree 22 2.1 Windows MSI Installer ........................ 22 2.2 Windows ZIP File .......................... 22 2.3 Linux tar.gz Files ........................... 22 2.4 macOS PKG Installer ........................ 23 2.5 macOS ZIP file ............................ 23 3 Compiling Embree 24 3.1 Linux and macOS .......................... 24 3.2 Windows ............................... 26 3.3 CMake Configuration ......................... 28 4 Using Embree 32 5 Embree API 33 5.1 Device Object ............................. 34 5.2 Scene Object ............................. 34 5.3 Geometry Object ........................... 35 5.4 Ray Queries .............................. 35 5.5 Point Queries ............................. 36 5.6 Collision Detection .......................... 36 5.7 Miscellaneous ............................. 36 6 Upgrading from Embree 2 to Embree 3 37 6.1 Device ................................. 38 6.2 Scene ................................. 38 6.3 Geometry ............................... 38 6.4 Buffers ................................. 40 6.5 Miscellaneous ............................. 40 1 7 Embree API Reference 43 7.1 rtcNewDevice ............................. 43 7.2 rtcRetainDevice ............................ 46 7.3 rtcReleaseDevice ........................... 47 7.4 rtcGetDeviceProperty ........................ 48 7.5 rtcGetDeviceError .......................... 51 7.6 rtcSetDeviceErrorFunction ...................... 52 7.7 rtcSetDeviceMemoryMonitorFunction ............... 53 7.8 rtcNewScene ............................. 55 7.9 rtcGetSceneDevice .......................... 56 7.10 rtcRetainScene ............................ 57 7.11 rtcReleaseScene ............................ 58 7.12 rtcAttachGeometry .......................... 59 7.13 rtcAttachGeometryByID ....................... 60 7.14 rtcDetachGeometry .......................... 61 7.15 rtcGetGeometry ........................... 62 7.16 rtcCommitScene ........................... 63 7.17 rtcJoinCommitScene ......................... 64 7.18 rtcSetSceneProgressMonitorFunction ................ 66 7.19 rtcSetSceneBuildQuality ....................... 68 7.20 rtcSetSceneFlags ........................... 69 7.21 rtcGetSceneFlags ........................... 70 7.22 rtcGetSceneBounds .......................... 71 7.23 rtcGetSceneLinearBounds ...................... 72 7.24 rtcNewGeometry ........................... 73 7.25 RTC_GEOMETRY_TYPE_TRIANGLE ............. 76 7.26 RTC_GEOMETRY_TYPE_QUAD ................ 78 7.27 RTC_GEOMETRY_TYPE_GRID ................ 80 7.28 RTC_GEOMETRY_TYPE_SUBDIVISION ........... 82 7.29 RTC_GEOMETRY_TYPE_CURVE ............... 85 7.30 RTC_GEOMETRY_TYPE_POINT ............... 90 7.31 RTC_GEOMETRY_TYPE_USER ................ 92 7.32 RTC_GEOMETRY_TYPE_INSTANCE ............. 94 7.33 RTCCurveFlags ............................ 96 7.34 rtcRetainGeometry .......................... 97 7.35 rtcReleaseGeometry ......................... 98 7.36 rtcCommitGeometry ......................... 99 7.37 rtcEnableGeometry .......................... 100 7.38 rtcDisableGeometry ......................... 101 7.39 rtcSetGeometryTimeStepCount ................... 102 7.40 rtcSetGeometryTimeRange ..................... 103 7.41 rtcSetGeometryVertexAttributeCount ............... 104 7.42 rtcSetGeometryMask ......................... 105 7.43 rtcSetGeometryBuildQuality .................... 106 7.44 rtcSetGeometryBuffer ........................ 107 7.45 rtcSetSharedGeometryBuffer .................... 108 2 7.46 rtcSetNewGeometryBuffer ...................... 110 7.47 RTCFormat .............................. 111 7.48 RTCBufferType ............................ 113 7.49 rtcGetGeometryBufferData ..................... 115 7.50 rtcUpdateGeometryBuffer ...................... 116 7.51 rtcSetGeometryIntersectFilterFunction ............... 117 7.52 rtcSetGeometryOccludedFilterFunction .............. 120 7.53 rtcFilterIntersection ......................... 121 7.54 rtcFilterOcclusion .......................... 122 7.55 rtcSetGeometryUserData ...................... 123 7.56 rtcGetGeometryUserData ...................... 124 7.57 rtcSetGeometryUserPrimitiveCount ................ 125 7.58 rtcSetGeometryBoundsFunction ................... 126 7.59 rtcSetGeometryIntersectFunction .................. 128 7.60 rtcSetGeometryOccludedFunction .................. 130 7.61 rtcSetGeometryPointQueryFunction ................ 132 7.62 rtcSetGeometryInstancedScene ................... 135 7.63 rtcSetGeometryTransform ...................... 136 7.64 rtcSetGeometryTransformQuaternion ................ 137 7.65 rtcGetGeometryTransform ...................... 138 7.66 rtcSetGeometryTessellationRate ................... 139 7.67 rtcSetGeometryTopologyCount ................... 140 7.68 rtcSetGeometrySubdivisionMode .................. 141 7.69 rtcSetGeometryVertexAttributeTopology .............. 143 7.70 rtcSetGeometryDisplacementFunction ............... 144 7.71 rtcGetGeometryFirstHalfEdge .................... 146 7.72 rtcGetGeometryFace ......................... 148 7.73 rtcGetGeometryNextHalfEdge .................... 150 7.74 rtcGetGeometryPreviousHalfEdge ................. 152 7.75 rtcGetGeometryOppositeHalfEdge ................. 154 7.76 rtcInterpolate ............................. 156 7.77 rtcInterpolateN ............................ 158 7.78 rtcNewBuffer ............................. 160 7.79 rtcNewSharedBuffer ......................... 161 7.80 rtcRetainBuffer ............................ 162 7.81 rtcReleaseBuffer ........................... 163 7.82 rtcGetBufferData ........................... 164 7.83 RTCRay ................................ 165 7.84 RTCHit ................................ 167 7.85 RTCRayHit .............................. 168 7.86 RTCRayN ............................... 169 7.87 RTCHitN ............................... 170 7.88 RTCRayHitN ............................. 171 7.89 rtcInitIntersectContext ........................ 172 7.90 rtcIntersect1 .............................. 174 7.91 rtcOccluded1 ............................. 176 3 7.92 rtcIntersect4/8/16 .......................... 178 7.93 rtcOccluded4/8/16 .......................... 180 7.94 rtcIntersect1M ............................ 182 7.95 rtcOccluded1M ............................ 184 7.96 rtcIntersect1Mp ............................ 186 7.97 rtcOccluded1Mp ........................... 187 7.98 rtcIntersectNM ............................ 188 7.99 rtcOccludedNM ............................ 190 7.100rtcIntersectNp ............................ 192 7.101rtcOccludedNp ............................ 194 7.102rtcInitPointQueryContext ...................... 196 7.103rtcPointQuery ............................. 198 7.104rtcCollide ............................... 200 7.105rtcNewBVH .............................. 202 7.106rtcRetainBVH ............................ 203 7.107rtcReleaseBVH ............................ 204 7.108rtcBuildBVH ............................. 205 7.109RTCQuaternionDecomposition ................... 209 7.110rtcInitQuaternionDecomposition .................. 211 8 Performance Recommendations 212 8.1 MXCSR control and status register ................. 212 8.2 Thread Creation and Affinity Settings ............... 212 8.3 Fast Coherent Rays .......................... 213 8.4 Huge Page Support .......................... 213 8.5 Avoid store-to-load forwarding issues with single rays ....... 214 9 Embree Tutorials 216 9.1 Minimal ................................ 217 9.2 Triangle Geometry .......................... 218 9.3 Dynamic Scene ............................ 219 9.4 Multi Scene Geometry ........................ 220 9.5 User Geometry ............................ 221 9.6 Viewer ................................. 222 9.7 Stream Viewer ............................ 223 9.8 Intersection Filter .......................... 224 9.9 Instanced Geometry ......................... 225 9.10 Multi Level Instancing ........................ 226 9.11 Path Tracer .............................. 227 9.12 Hair .................................. 228 9.13 Curve Geometry ........................... 229 9.14 Subdivision Geometry ........................ 230 9.15 Displacement Geometry ....................... 231 9.16 Grid Geometry ............................ 232 9.17 Point Geometry ............................ 233 9.18 Motion Blur Geometry ........................ 234 4 9.19 Quaternion Motion Blur ....................... 235 9.20 Interpolation ............................. 236 9.21 Closest Point ............................. 237 9.22 Voronoi ................................ 238 9.23 Collision Detection .......................... 239 9.24 BVH Builder ............................. 239 9.25 BVH Access .............................. 240 9.26 Find Embree ............................. 240 9.27 Next Hit ................................ 240 5 Chapter 1 Embree Overview Intel® Embree is a collection of high-performance ray tracing kernels, developed at Intel. The target users of Intel® Embree are graphics application engineers who want to improve the performance of their photo-realistic rendering appli- cation by leveraging Embree’s performance-optimized ray tracing kernels. The kernels are optimized for the latest Intel® processors with support for SSE, AVX, AVX2, and AVX-512 instructions. Intel® Embree supports runtime code selection to