[OptiX 7] Instance motion blur

Hi,
Now I’m trying to do instance motion blur and got several questions.

Let’s assume I have an IAS whose children are:

  • Instance 0: GAS Instance (GAS A)
  • Instance 1: GAS Instance (GAS B)
  • Instance 2-101: SRT Transform whose child is GAS C

I’d like to create this IAS with configuration that numKeys = 2, timeBegin = 0.0f, timeEnd = 1.0f, flags = OPTIX_MOTION_FLAG_NONE.

  1. Does the traversable graph depth exceed “single level instancing”?
    So, do I need to use OPTIX_TRAVERSABLE_GRAPH_FLAG_ALLOW_ANY?
  2. Do I need to set a pointer to an array with a size of 102 * 2 * OptixAabb to OptixBuildInputInstanceArray::aabbs and set 204 to OptixBuildInputInstanceArray::numAabbs?
  3. Do I need to compute contents of the AABB array by myself?
    Does it mean manually computing AABB of GAS C and transforming its corners per instance per key to compute conservative AABB?
  4. I found the description:
    “In case of OPTIX_BUILD_INPUT_TYPE_INSTANCES, the second element (with a size of M * 6 floats) will be ignored.” at the comment for OptixBuildInputInstanceArray, but I couldn’t understand what this says. I suppose the second element is AABB for the 1st instance and its second key, therefore it can’t be ignored if the 1st instance is in motion. Could you explain with other wording?

Thanks,

Hi these are good questions, the motion transforms can be a bit tricky.

1- Yes, with your described setup your scene traversal depth will be 3, and you will have 2 levels of instances, one for the motion transform and one for GAS C. You will need to use OPTIX_TRAVERSABLE_GRAPH_FLAG_ALLOW_ANY and a traversal depth of 3 for the purposes of setting your stack sizes.

2- Correct, you want numAabbs = numKeys * numInstances. Since you have 2 keys and 102 instances total, the aabbs array should point to a buffer with space for 204 * 6 floats.

3- Currently yes you do need to compute your own AABBs for all the motion AS children (but not the static AS children - this is directly related to the next question). Regarding transforming the corners, the AABBs should account for your traversable SRT transform, but not any transforms you use in the IAS.

4- The comment here is a continuation of the example in the paragraph above it. The comments are saying that instances that are a static AS will ignore the motion aabbs you provide for that instance, but you’ll still need to include space for them in the aabbs array. So if your 2nd instance is a static AS, then all the motion aabbs for the 2nd instance will be ignored, but if your 3rd instance is a motion AS, then OptiX will use all the aabbs for the 3rd instance.

In your case, this means you will need space for 204 aabbs, but the first 4 of them will be ignored.

It might make more sense if the paragraphs were combined together. We will make these comments more clear.

/// [...] Pointers may be NULL if the aabbs are not required.
/// Hence, if the second instance (inst1) points to a static GAS, aabbs are not
/// required for that instance.  While being ignored, aabbs must still be a device
/// pointer to an array of N elements. [For example...]
/// In case of OPTIX_BUILD_INPUT_TYPE_INSTANCES, the second element (with a size of M *
/// 6 floats) will be ignored.  In case of OPTIX_BUILD_INPUT_TYPE_INSTANCE_POINTERS,
/// the second element (with a size of pointer to M * 6 floats) can be NULL.


David.

I thought at first that what we need to do is just providing motion AABB space and its contents will be computed automatically by OptiX runtime (but comments in the source seem to say that we need to do it manually).

You answer clarified my questions.
Thank you for your quick reply!

Ah, I must set max traversable graph depth!
Actually, I saw error messages: error: traversal depth exceeded but I mis-interpret the depth as something like stack depth used for BVH traversal. So it means “traversable graph depth exceeded”.

I should have read the optixSimpleMotionBlur sample in detail.

Thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.