MoGraph data index and Multi-Instances
-
When using a MoGraph Cloner in Instance or Render Instance mode, the MoGraph data index is available via the
BC_ID_MODATAINDEX
id in each clone.clone->GetDataInstance()->GetInt32(BC_ID_MODATAINDEX);
This is the index of the clone in the data arrays of the MoGraph Data tag.
Is this index available in Multi-Instance mode as well via the SDK? Via the InstanceObject maybe?
We'd need this index to be able to export MoGraph attributes to each clone/instance. -
Hey @peter_horvath,
Thank you for reaching out to us. I am a little bit confused as I do not truly understand your question. You are an experienced developer, so it seems a bit unlikely that you overlooked what I am explaining next.
In the video below I have unfolded the cache of a MoGraph cloner and switch through the modes, which are admittedly named quite confusingly, but the docs mostly clear up their purpose:
- Instances: Nothing is really being instantiated here at all, there are three copies of the clone geometry in the cache of the cloner. Not the most memory efficient thing in the world when you have many clones. Would probably be better named as Copies.
- Render Instances: Here we have one copy and two instance objects pointing to that copy. So, we pay the price of one original, a the low price of two objects pointing to that one original. Would probably be better named just as Instances.
- Multi-Instances: Again, there are no instances going on here, and also no 'multi' at all. Opposed to the previous modes, this mode only holds a singular object in its cache (wrapped in an additional null) which is a copy of the input. The cloning will only happen at render time (at least that was always what I thought would happen).
-
Hi Ferdinand,
Thanks for your feedback, Yes, I'm aware of the object structure. Let me explain a bit more what I'm trying to do and what I'm missing.
Here's a simple example of a Cloner with two shapes, a Sphere and a Torus, and a Plain Effector with a Spherical Field. The effector sets the weight of the clones (1 to zero from the middle) and also modifies the shape order ("Modify Clone" is enabled), so that Torus shapes are in the middle and Spheres are outside the field. So the shape order is not necessarily the same as how the data is stored on the mograph tag. I'd like to export weight as user data per shape. In Instance or Render Instance mode I can read the mograph data index from the clones, that tells me the weight from the MoData tag.
In Multi-Instance mode, I would expect the same result. However, since the indexes are not available, I can not connect the MoGraph data to the instances and read the weights. As you said, in Multi-Instance mode there are reference shapes and Instance Objects per each reference shape in the cache. The InstanceObject can return the matrices and colors of the individual shape instances, but no indexes as far as I can see. I'm not sure how complicated is to generate this data, but would be nice to have.
Cheers,
Peter