Alias General Discussion

Alias General Discussion

Reply
Active Member
sgeggie
Posts: 7
Registered: ‎04-11-2013
Message 1 of 5 (665 Views)
Accepted Solution

Alias API - Transformation for instances

665 Views, 4 Replies
08-16-2013 01:58 AM

I'm using the Alias API to retrieve model data from .wire files and I've run into a problem with the transformation matrix for instances.


I perform a recursive run through of the nodes of the Alias scene. For each node, I read the local transformation matrix with AlDagNode::localTransformationMatrix. If the node contains a mesh, I tesselate it using chordHeightDeviationAccurate/Fast. The resulting mesh seems to have the transformation included. That is, a 10x10x10 cube translated 100 units along the x-axis will have vertices with x-values at 95/105, rather than -5/5 as I would expect.

Normally, this is not a problem, since I can apply the inverse transformation matrix to get the vertices in "local" space. But for instanced geometry, the vertices include the transformation of the "original".

 

The information I ideally want to end up with is:

- For each mesh object, the "original", untransformed vertex coordinates. (This currently fails, as the mesh I get includes the original geometry's transformation)
- For each instance group, the transformation matrix to apply (Which seems to be possible already using localTransformationMatrix)

Is this at all possible? I'm hoping there is a solution which allows me to see that A) the current mesh is instanced from another and B) what the original transformation matrix was to then C) use AlTM::transPoint "subtract" the original before adding the instance transformation.

 

Any ideas? I have attached a very small sample program which illustrates the problem by outputting the relevant information about a .wire file to a simple .txt.

I found a work-around which seems to suffice for now.

Basically, I assume that if a node is an instancenode (check with isInstanceNode()), then the "original" node is the first node in its instance list. So I just run back with prevInstance() until I find the first node, then retrieve that node's transformation.

It's not ideal, since it relies so much on that assumption, but it seems to work.

Active Member
sgeggie
Posts: 7
Registered: ‎04-11-2013
Message 2 of 5 (584 Views)

Re: Alias API - Transformation for instances

11-14-2013 01:41 AM in reply to: sgeggie

I found a work-around which seems to suffice for now.

Basically, I assume that if a node is an instancenode (check with isInstanceNode()), then the "original" node is the first node in its instance list. So I just run back with prevInstance() until I find the first node, then retrieve that node's transformation.

It's not ideal, since it relies so much on that assumption, but it seems to work.

Valued Mentor
ravenzep
Posts: 401
Registered: ‎10-05-2009
Message 3 of 5 (576 Views)

Re: Alias API - Transformation for instances

11-14-2013 01:51 AM in reply to: sgeggie

Hi,

What's the point of this?

What would you use this for?

 

Regards.

Active Member
sgeggie
Posts: 7
Registered: ‎04-11-2013
Message 4 of 5 (572 Views)

Re: Alias API - Transformation for instances

11-14-2013 01:56 AM in reply to: ravenzep

I'm using it to output the scene tree to a third party program for rendering. So I want to export the untransformed vertices of the geometry and the transformation matrices seperately. This way, the third party program can edit the transformations and add new ones without editing the mesh data. :smileyhappy:

Valued Mentor
ravenzep
Posts: 401
Registered: ‎10-05-2009
Message 5 of 5 (560 Views)

Re: Alias API - Transformation for instances

11-16-2013 07:41 AM in reply to: sgeggie

Sounds cool.

Thanks for the info.... Good luck :smileywink:

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.