rtcInitIntersectContext.3embree3 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. .TH "rtcInitIntersectContext" "3" "" "" "Embree Ray Tracing Kernels 3"
  2. .SS NAME
  3. .IP
  4. .nf
  5. \f[C]
  6. rtcInitIntersectContext\ \-\ initializes\ the\ intersection\ context
  7. \f[]
  8. .fi
  9. .SS SYNOPSIS
  10. .IP
  11. .nf
  12. \f[C]
  13. #include\ <embree3/rtcore.h>
  14. enum\ RTCIntersectContextFlags
  15. {
  16. \ \ RTC_INTERSECT_CONTEXT_FLAG_NONE,
  17. \ \ RTC_INTERSECT_CONTEXT_FLAG_INCOHERENT,
  18. \ \ RTC_INTERSECT_CONTEXT_FLAG_COHERENT,
  19. };
  20. struct\ RTCIntersectContext
  21. {
  22. \ \ enum\ RTCIntersectContextFlags\ flags;
  23. \ \ RTCFilterFunctionN\ filter;
  24. \ \ unsigned\ int\ instID[RTC_MAX_INSTANCE_LEVEL_COUNT];
  25. };
  26. void\ rtcInitIntersectContext(
  27. \ \ struct\ RTCIntersectContext*\ context
  28. );
  29. \f[]
  30. .fi
  31. .SS DESCRIPTION
  32. .PP
  33. A per ray\-query intersection context (\f[C]RTCIntersectContext\f[]
  34. type) is supported that can be used to configure intersection flags
  35. (\f[C]flags\f[] member), specify a filter callback function
  36. (\f[C]filter\f[] member), specify the ID of the current instance
  37. (\f[C]instID\f[] member), and to attach arbitrary data to the query
  38. (e.g.
  39. per ray data).
  40. .PP
  41. The \f[C]rtcInitIntersectContext\f[] function initializes the context to
  42. default values and should be called to initialize every intersection
  43. context.
  44. This function gets inlined, which minimizes overhead and allows for
  45. compiler optimizations.
  46. .PP
  47. The intersection context flag can be used to tune the behavior of the
  48. traversal algorithm.
  49. Using the \f[C]RTC_INTERSECT_CONTEXT_FLAG_INCOHERENT\f[] flags uses an
  50. optimized traversal algorithm for incoherent rays (default), while
  51. \f[C]RTC_INTERSECT_CONTEXT_FLAG_COHERENT\f[] uses an optimized traversal
  52. algorithm for coherent rays (e.g.
  53. primary camera rays).
  54. .PP
  55. Best primary ray performance can be obtained by using the ray stream API
  56. and setting the intersect context flag to
  57. \f[C]RTC_INTERSECT_CONTEXT_FLAG_COHERENT\f[].
  58. For secondary rays, it is typically better to use the
  59. \f[C]RTC_INTERSECT_CONTEXT_FLAG_INCOHERENT\f[] flag, unless the rays are
  60. known to be very coherent too (e.g.
  61. for primary transparency rays).
  62. .PP
  63. A filter function can be specified inside the context.
  64. This filter function is invoked as a second filter stage after the
  65. per\-geometry intersect or occluded filter function is invoked.
  66. Only rays that passed the first filter stage are valid in this second
  67. filter stage.
  68. Having such a per ray\-query filter function can be useful to implement
  69. modifications of the behavior of the query, such as collecting all hits
  70. or accumulating transparencies.
  71. The support for the context filter function must be enabled for a scene
  72. by using the \f[C]RTC_SCENE_FLAG_CONTEXT_FILTER_FUNCTION\f[] scene flag.
  73. .PP
  74. It is guaranteed that the pointer to the intersection context passed to
  75. a ray query is directly passed to the registered callback functions.
  76. This way it is possible to attach arbitrary data to the end of the
  77. intersection context, such as a per\-ray payload.
  78. .PP
  79. Please note that the ray pointer is not guaranteed to be passed to the
  80. callback functions, thus reading additional data from the ray pointer
  81. passed to callbacks is not possible.
  82. .SS EXIT STATUS
  83. .PP
  84. No error code is set by this function.
  85. .SS SEE ALSO
  86. .PP
  87. [rtcIntersect1], [rtcOccluded1]