RTCINITINTERSECTARGUMENTS(3)

πŸ“¦
version 4.4.1 Β· 3 versions
, in ubuntu stonking

πŸ’– rtcInitIntersectArguments β€” bestie edition πŸ’–

okay so we're in the Embree Ray Tracing Kernels 4 manual, and today's page is rtcInitIntersectArguments(3) β€” the lil glow-up function that makes your intersect arguments struct not be full of garbage. let's get into it 🫢


✨ NAME ✨

rtcInitIntersectArguments β€” initializes the intersect arguments struct πŸ’…


✨ SYNOPSIS ✨

#include <embree4/rtcore.h>

enum RTCRayQueryFlags
{
  RTC_RAY_QUERY_FLAG_NONE,
  RTC_RAY_QUERY_FLAG_INCOHERENT,
  RTC_RAY_QUERY_FLAG_COHERENT,
  RTC_RAY_QUERY_FLAG_INVOKE_ARGUMENT_FILTER
};

struct RTCIntersectArguments
{
  enum RTCRayQueryFlags flags;
  enum RTCFeatureFlags feature_mask;
  struct RTCRayQueryContext* context;
  RTCFilterFunctionN filter;
  RTCIntersectFunctionN intersect;
#if RTC_MIN_WIDTH
  float minWidthDistanceFactor;
#endif
};

void rtcInitIntersectArguments(
  struct RTCIntersectArguments* args
);

✨ DESCRIPTION ✨

so rtcInitIntersectArguments initializes the optional argument struct β€” the one you can pass to the rtcIntersect1/4/8/16 functions β€” and it fills it with default values. no cap. if you wanna use the more advanced Embree features, you literally need this struct, and everything's described right here bestie πŸ‘‘

🌸 the members, one by one 🌸

  • flags β€” this is where you turn on a special traversal mode. use RTC_RAY_QUERY_FLAG_INCOHERENT and you get an optimized traversal algorithm for incoherent rays (that's the default, iykyk). use RTC_RAY_QUERY_FLAG_COHERENT and you get an optimized traversal algorithm for coherent rays, like primary camera rays. pick your fighter ✨
  • feature_mask β€” in SYCL you should use this to just enable the ray tracing features you actually need to render a given scene. the section [RTCFeatureFlags] has the full tea, go read it πŸ“
  • context β€” here you pass an optional intersection context. and it's guaranteed that the pointer to the context you pass to a ray query gets passed directly to all callback functions. so you can attach arbitrary data to the end of the context, like a per-ray payload. iconic. BUT 🚨 heads up: the ray pointer is not guaranteed to be passed to the callback functions, so reading additional data off the ray pointer inside callbacks is not possible. section [rtcInitRayQueryContext] has more deets πŸ’œ
  • filter β€” this one specifies a filter function to invoke for each encountered hit. important: support for the argument filter function has to be enabled for a scene using the RTC_SCENE_FLAG_FILTER_FUNCTION_IN_ARGUMENTS scene flag. and if you're doing instancing, you gotta enable this feature for each instantiated scene too. no skipping πŸ™ˆ

okay so the argument filter function gets invoked for each geometry for which it got explicitly enabled using the rtcSetGeometryEnableFilterFunctionFromArguments function. you can also enforce the invocation of the argument filter function for each geometry using the RTC_RAY_QUERY_FLAG_INVOKE_ARGUMENT_FILTER ray query flag. this argument filter function is invoked as a second filter stage, after the per-geometry filter function is invoked β€” and only rays that passed the first filter stage are valid in this second filter stage. lowkey the whole point: having a per ray-query filter function is useful for implementing modifications of the behavior of the query, like collecting all hits or accumulating transparencies. slay ✨

  • intersect β€” this specifies the user geometry callback to get invoked for each user geometry encountered during traversal. and the user geometry callback you specify this way has preference over the one specified inside the geometry. main character energy, periodt πŸ‘‘
  • minWidthDistanceFactor β€” this value controls the target size of the curve radii when the min-width feature is enabled. see the [rtcSetGeometryMaxRadiusScale] function for more details on the min-width feature. also note it's wrapped in #if RTC_MIN_WIDTH up in the struct, so it only exists when that's on πŸŽ€

✨ EXIT STATUS ✨

no error code is set by this function. zero drama, we love that for us πŸ’–


✨ SEE ALSO ✨

[rtcIntersect1], [rtcIntersect4/8/16], [RTCFeatureFlags], [rtcInitRayQueryContext], [RTC_GEOMETRY_TYPE_USER], [rtcSetGeometryMaxRadiusScale] β€” go read those next bestie, they're all part of the same saga πŸ¦‹


and that's the whole page!! this was rtcInitIntersectArguments(3) from the Embree Ray Tracing Kernels 4 manual β€” footer's just the page name again (squeezed down to rtcInitIn...tArguments(3) because terminals are haters), so nothing extra hiding down there. ily, go initialize your structs πŸ’œβœ¨πŸŽ€

πŸ“¦ where this page comes from