RenderKit / embree

Embree ray tracing kernels repository.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why does RTC_RAY_QUERY_FLAG_INVOKE_ARGUMENT_FILTER not apply to user-defined geometries?

Tradias opened this issue · comments

Given a user-defined geometry (RTC_GEOMETRY_TYPE_USER) added to a scene with RTC_SCENE_FLAG_FILTER_FUNCTION_IN_ARGUMENTS then the following code:

RTCIntersectArguments args
// ...
args.filter = some_filter;
args.flags = RTC_RAY_QUERY_FLAG_INVOKE_ARGUMENT_FILTER;
rtcIntersect1(scene, &rayhit, &args);

never invokes some_filter even though the documentation says that:

The callback is only invoked for geometries that enable the callback using the rtcSetGeometryEnableFilterFunctionFromArguments call, or enabled for all geometries when the RTC_RAY_QUERY_FLAG_INVOKE_ARGUMENT_FILTER ray query flag is set.

Even enabling rtcSetGeometryEnableFilterFunctionFromArguments has no effect.

This issue describes a workaround #441 but it would be nice to either change the documentation or change the behavior.

embree version 4.3.0

You are right, filter functions are newer called for user defined geometries automatically. You either have to add some rtcInvokeIntersectFilterFromGeometry call to invoke the filter function stored inside the geometry by hand, or pass the function set inside the RTCIntersectArguments manually through the context and call it.

I am doing doing the latter, but it took me a while to figure out because the documentation confused me and does not mention the latter approach to my knowledge.