Notifications
Clear all

[Closed] Detecting instances of the same geometric object

Hi,

I’m writing a plugin to integrate the appleseed renderer into 3ds Max.

In order to minimize the memory footprint of the scene to be rendered, I would like to detect when an object in the Max scene is an instance of another object (i.e. a reference to another object + a transformation matrix).

I naively thought that I could just check the name of the Object referenced by an INode, but that doesn’t seem to be the right thing to do.

What is the correct way to detect instances?

Franz

6 Replies
IInstanceMgr::GetInstanceMgr()->GetInstances

Thanks for the answer. It works perfectly.

but you have to know that this method returns both instances and references

Thanks.

Indeed I have a problem when it comes to references:

(From left to right, top to bottom: source object, instance, reference with additional modifier, copy.)

Code handling instancing:
https://github.com/appleseedhq/appleseed-max/blob/master/src/projectbuilder.cpp#L285-L319

How do I distinguish between instances and references?

difference between node instance and node reference is that all instances have the same object reference.
check:

node->GetObjectRef()

Thanks Denis, it works perfectly now.

For future reference, here’s the new code:
https://github.com/appleseedhq/appleseed-max/blob/a15fec97fc9644bfd7dcfaff0ba0a6b60825cedb/src/projectbuilder.cpp#L278-L326

It’s no longer based on IInstanceMgr, it simply uses node->GetObjectRef() as suggested by Denis.