Community
Alias Forum
Welcome to Autodesk’s Alias Forums. Share your knowledge, ask questions, and explore popular Alias topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Alias API - Transformation for instances

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
sgeggie
1060 Views, 4 Replies

Alias API - Transformation for instances

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.

4 REPLIES 4
Message 2 of 5
sgeggie
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.

Message 3 of 5
ravenzep
in reply to: sgeggie

Hi,

What's the point of this?

What would you use this for?

 

Regards.

Message 4 of 5
sgeggie
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. 🙂

Message 5 of 5
ravenzep
in reply to: sgeggie

Sounds cool.

Thanks for the info.... Good luck 😉

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report