rtcIntersect1.3embree3 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. .TH "rtcIntersect1" "3" "" "" "Embree Ray Tracing Kernels 3"
  2. .SS NAME
  3. .IP
  4. .nf
  5. \f[C]
  6. rtcIntersect1\ \-\ finds\ the\ closest\ hit\ for\ a\ single\ ray
  7. \f[]
  8. .fi
  9. .SS SYNOPSIS
  10. .IP
  11. .nf
  12. \f[C]
  13. #include\ <embree3/rtcore.h>
  14. void\ rtcIntersect1(
  15. \ \ RTCScene\ scene,
  16. \ \ struct\ RTCIntersectContext*\ context,
  17. \ \ struct\ RTCRayHit*\ rayhit
  18. );
  19. \f[]
  20. .fi
  21. .SS DESCRIPTION
  22. .PP
  23. The \f[C]rtcIntersect1\f[] function finds the closest hit of a single
  24. ray with the scene (\f[C]scene\f[] argument).
  25. The provided ray/hit structure (\f[C]rayhit\f[] argument) contains the
  26. ray to intersect and some hit output fields that are filled when a hit
  27. is found.
  28. .PP
  29. The user has to initialize the ray origin (\f[C]org\f[] ray member), ray
  30. direction (\f[C]dir\f[] ray member), ray segment (\f[C]tnear\f[],
  31. \f[C]tfar\f[] ray members), and set the ray flags to \f[C]0\f[]
  32. (\f[C]flags\f[] ray member).
  33. If the scene contains motion blur geometries, also the ray time
  34. (\f[C]time\f[] ray member) must be initialized to a value in the range
  35. [0, 1].
  36. If ray masks are enabled at compile time, the ray mask (\f[C]mask\f[]
  37. ray member) must be initialized as well.
  38. The ray segment has to be in the range [0, ∞], thus ranges that start
  39. behind the ray origin are not valid, but ranges can reach to infinity.
  40. See Section [RTCRay] for the ray layout description.
  41. .PP
  42. The instance ID (\f[C]instID\f[] hit member) and geometry ID
  43. (\f[C]geomID\f[] hit member) of the hit data must be initialized to
  44. \f[C]RTC_INVALID_GEOMETRY_ID\f[] (\-1).
  45. .PP
  46. Further, an intersection context for the ray query function must be
  47. created and initialized (see \f[C]rtcInitIntersectContext\f[]).
  48. .PP
  49. When no intersection is found, the ray/hit data is not updated.
  50. When an intersection is found, the hit distance is written into the
  51. \f[C]tfar\f[] member of the ray and all hit data is set, such as
  52. unnormalized geometry normal in object space (\f[C]Ng\f[] hit member),
  53. local hit coordinates (\f[C]u\f[], \f[C]v\f[] hit member), instance ID
  54. (\f[C]instID\f[] hit member), geometry ID (\f[C]geomID\f[] hit member),
  55. and primitive ID (\f[C]primID\f[] hit member).
  56. See Section [RTCHit] for the hit layout description.
  57. .PP
  58. If the instance ID was set (thus it is not equal to
  59. \f[C]RTC_INVALID_GEOMETRY_ID\f[]), the instance ID corresponds to the
  60. geometry ID of the hit instance of the top\-level scene, the geometry ID
  61. corresponds to the hit geometry inside the hit instanced scene, and the
  62. primitive ID corresponds to the n\-th primitive of that geometry.
  63. .PP
  64. If the instance ID was not set (thus it is still equal to
  65. \f[C]RTC_INVALID_GEOMETRY_ID\f[]), the geometry ID corresponds to the
  66. hit geometry inside the scene, and the primitive ID corresponds to the
  67. n\-th primitive of that geometry.
  68. .PP
  69. The implementation makes no guarantees that primitives whose hit
  70. distance is exactly at (or very close to) \f[C]tnear\f[] or
  71. \f[C]tfar\f[] are hit or missed.
  72. If you want to exclude intersections at \f[C]tnear\f[] just pass a
  73. slightly enlarged \f[C]tnear\f[], and if you want to include
  74. intersections at \f[C]tfar\f[] pass a slightly enlarged \f[C]tfar\f[].
  75. .IP
  76. .nf
  77. \f[C]
  78. \f[]
  79. .fi
  80. .IP
  81. .nf
  82. \f[C]
  83. \f[]
  84. .fi
  85. .PP
  86. The ray/hit structure must be aligned to 16 bytes.
  87. .SS EXIT STATUS
  88. .PP
  89. For performance reasons this function does not do any error checks, thus
  90. will not set any error flags on failure.
  91. .SS SEE ALSO
  92. .PP
  93. [rtcOccluded1], [RTCRayHit], [RTCRay], [RTCHit]