3dsmax Space to Houdini Space

   10083   8   2
User Avatar
Member
252 posts
Joined:
Offline
I'm getting the detail attribute hemax_translate, hemax_rotate, and hemax_scale from an object in 3dsmax through the engine.
How do to I convert these so that the values can be used in a Transform SOP?

Basically I just want to get the world space transform of an object in 3dsmax, and use that data to drive the transform on a geometry in my houdini asset.

Currently, I tried reading them directly using detail()
Switching rz with ry
But the results does not reflect what is in 3dsmax >_<
I also noticed, when using the debug options, houdni engine create two Objects in the houdini scene.
One with locked geometry, and one with a an object merge getting the locked geometry. both of these objects have transforms in them..


Will investigate further..
User Avatar
Staff
387 posts
Joined: Aug. 2017
Offline
Listed below is some pseudocode for going from 3ds Max's coordinate system to Houdini's coordinate system. Just a note that 3ds Max represents the rotation as a quaternion internally:

hou_position.x = hemax_translate.x
hou_position.y = hemax_translate.z
hou.position.z = -hemax_translate.y

hou_quaternion.x = hemax_quaternion.x
hou_quaternion.y = hemax_quaternion.z
hou_quaternion.z = -hemax_quaternion.y
hou_quaternion.w = -hemax_quaternion.w

hou_scale.x = hemax_scale.x
hou_scale.y = hemax_scale.z
hou_scale.z = hemax_scale.y

If there's a difference in units (e.g. 3ds Max isn't set to use meters), then the translation would have to be multiplied by the conversion factor.

The reason for 2 nodes being created when supplying an input to an object HDA is for some future-proofing. If for example, 2 separate HDAs are using the same input from 3ds Max, the locked geometry node will only be created once, which can then be shared amongst instances of HDAs using that input. The extra object merge will allow for transforms of inputs to be manipulated independently from the source geometry's transform, and will also allow for merging multiple geometries into a single input (and prevent having to re-marshall the same data).
Edited by BrookeA - Aug. 28, 2019 15:21:26
User Avatar
Member
252 posts
Joined:
Offline
Hey Brandon, thank you for this info!

Regarding the information that I'm getting from 3dsmax, this is what the Details look like:


For comparison, here's the extracted transform information from 3dsmax:


And here's a table of the values:


The position values looks pretty straight forward.
But for the rotation, I'm not sure what the values represent, and how to use them >_<
Currently they are not in quat form.
Is it possible to maybe get matrix4?

The intention is to hopefully use it on a Transform SOP like so:


But using those values as is does not produce the same transformation result as in 3dsmax
Edited by galagast - Aug. 28, 2019 22:37:10

Attachments:
Houdini Engine 3dsmax - Detail Info.jpg (16.2 KB)
Houdini Engine 3dsmax - Tranforms Values.jpg (16.2 KB)
Houdini Engine 3dsmax - Table Comparison.jpg (27.9 KB)
Houdini Engine 3dsmax - Use Xform Values.jpg (34.2 KB)

User Avatar
Member
252 posts
Joined:
Offline
For the meantime, I derived a matrix from the mesh (Circle spline) that is coming from 3dsmax using the points and normal data. Which i then used to extract the correct rotation information. So far it works.
User Avatar
Staff
387 posts
Joined: Aug. 2017
Offline
The rotation values aren't as straightforward because the plugin converts the 3ds Max quaternion into Houdini's coordinate system and then converts it to Euler angles.

Would it help if it also attached the raw 3ds Max quaternion as a detail attribute? Something like hemax_quaternion. Then I believe you should be able to use the conversion in my previous post to create a quaternion in Houdini and also be able to convert it to Euler angles.
Edited by BrookeA - Aug. 30, 2019 15:25:11
User Avatar
Member
252 posts
Joined:
Offline
Hey Brandon, yes i believe the raw values would be great, then we could just convert them to the Houdini equivalent.

Or maybe, just attach the full raw transform matrix of the object.. one on worldspace, and one on local space (in case it is in a hierarchy)?

Something like hemax_transform_world and hemax_transform_local.
Just note on the documentation that these values are raw. then add some code examples on how to extract and/or convert them using any of the houdini methods via vex, vops, hscript and/or python.
User Avatar
Staff
387 posts
Joined: Aug. 2017
Offline
Geometry inputs will now have 3 new detail attributes attached – hemax_quaternion, hemax_transform_world, and hemax_transform_local.

hemax_quaternion: this is the rotation (in Houdini's coordinate system) before it gets converted to Euler angles and placed in hemax_rotation.

hemax_transform_world: This is the raw world space transformation matrix of the 3ds Max node.

hemax_transform_local: This is the raw local space transformation matrix of the 3ds Max node.

This will be available in tomorrow's daily build.
Edited by BrookeA - Sept. 4, 2019 14:07:50
User Avatar
Member
4 posts
Joined: Aug. 2020
Offline
I got the same problem as galagast and can't find any solution to this

I want to merge two objects via object_merge but can't apply neither hemax_transform_world nor old one hemax_translate. I've read all the documentation "Houdini Engine for 3Ds Max" through and still can't find the proposed attributes. There is no info about objects' transform at all

Would appreciate any help on this topic or hip/hda example of how it's supposed to work

Thanks in advance!
User Avatar
Member
4 posts
Joined: Aug. 2020
Offline
In case someone will get stuck with the same trouble of converting space and need a bit clearer look at that. I did this using Houdini 19.5 and 3Ds Max 2022

3Ds Max stores initial position of object either in the zero coords or in the xForm. No matter how you move it around the scene. When moving object to Houdini via HDA the detail attributes are created: hemax_translate, hemax_rotate, hemax_scale, others and model appears in the initial transformation in Houdini (that zero coords/xform transform from 3Ds Max).

To move it to the same position in Houdini as it is in 3Ds Max, there is a need to create next attribute snippet:

vector t = detail(0, "hemax_translate", 0);
vector r = detail(0, "hemax_rotate", 0);
vector s = detail(0, "hemax_scale", 0);

matrix m = maketransform(0, 5, t, r, s);

@P *= m;

As far as I can see, 5th order of rotation solves issue which galagast noticed earlier and allows to align object back to position in 3Ds Max after modifying with HDA.
  • Quick Links