Jump to content

transform the primitive


syzmatrix

Recommended Posts

really nice example.

I'm looking to do something similar but take one step further.

I'd like to export a primitive face to Maya but give the geometry the proper worldspace transform position and rotation. This means promoting the translation and rotation above the SOP to the OBJ level.

so this example gets halfway there. the face gets centered an oriented but then how to reverse the transforms at the object level to put it back in space for export.

Link to comment
Share on other sites

I have an example of trying to move the transforms to the OBJ level so it can be exported.

there is still a problem with a few things.

The look at vector does not properly add rotation values to the paramaters. This means it won't export the rotations with FBX.

The look at vector still has a slight twist to it. In this example the first frame looks pretty good but the other frames you can see the twist gets pretty bad. I tried to counter it with an offset rotation in a null but it doesn't really work.

WorldSPace_V4.hipnc

Link to comment
Share on other sites

I think I sorted it with the help from this thread.

http://forums.odforc...uler#entry46496

pretty much the same process but I didn't incorporate through chops and was more for taking a random face and giving it worldspace transforms

the challenge was inverting the rotation values not only involves negative multiplication of numbers but also going in the reverse rotation order, so xyz turns into zyx.

Id like to know if there was a vex operator to align to 2 axis so I could control the twist of the object as it flips to the normal orientation. currently the align will take a normal and flip to another normal but there is a twist that you could tell it which way to rotate along that normal if that makes sense.

WorldSpace_V5.hipnc

Edited by breadbox
Link to comment
Share on other sites

  • 2 weeks later...

Im working on a more exact transformation matrix. Using the Align in the VOP is nice but it doesn't control the twist of the primitive once it gets rotated to the proper orientation. I've seen it used in math books where you must supply 2 points on a plane to orient properly with a twist.

attached are my working files and ref image.

ExportFaceTransforms_V6.hipnc

post-5696-0-12467000-1354492304_thumb.jp

Edited by breadbox
Link to comment
Share on other sites

  • 3 weeks later...

I looked into the problem a bit more. my problem is a bit different from the original post.

Id like to orient all axis not just align one.

here is the HIP file showing the problem. the face does get aligned in 3D but only on one axis (Y is correct). its correct in 3D space, but it would be better to align to all axis for exporting.

A few diagrams attached, these are from XSI ICE tutorials I think the math will work the same.

In the vops I'm not sure how I would pick out the 3 points.

ExportFaceTransforms_V10.hipnc

post-5696-0-27151300-1355875790_thumb.pn

post-5696-0-70789900-1355875817_thumb.pn

Link to comment
Share on other sites

  • 2 weeks later...

I tried just for fun to use deeper math with cross products to solve the equation.

I think I got the same result. this time, no look at. but yea "look at" was much easier I think yours is better. Its kind of a bummer there is no vector to matrix node. having to go from vector>float>matrix seems unnecessary.

attached is my result hip.

sometimes I'm not sure exactly when to negate or invert a vector but some trial and error seemed to work.

Thanks for all the help this has been most instructive. also this was a nice blog about matrix that I found helpful as well.

http://www.andynicholas.com/?p=861

VectorCalculations_V2.hipnc

Link to comment
Share on other sites

...

sometimes I'm not sure exactly when to negate or invert a vector but some trial and error seemed to work.

...

you don't have to negate those vectors if you've computed cross product correctly, the output vector direction depends on order of inputs to cross VOP (right hand rule of cross product)

it seems that you've had quite guess-game with axis names and order in matrix as well :)

here is modified version without guessing

VectorCalculations_V2_mod.hipnc

Link to comment
Share on other sites

ah ok great. yea that makes sense the order of inputs can cause the output result to differ, its not like multiplication.

I have another problem that I have noticed with this method. I'n the position attr, it looks slightly off for some objects, with the house it was fine, but now i use a platonic and the faces don't seem to center properly.

I had another method to calculate the center $CEX,Y,Z in a prim attrCreate. this seems more accurate. check it out. not sure why the output would be different though.

also something else odd, when I calculate $CEX,Y,Z in a point attrCreate the result is different than if in a prim attrCreate?

any explanation for this?

I'm not sure if you would be able to calculate a prim $CEX,Y,Z in VOPS?

attached is one workaround by passing the Prim Attr into the VOPS. seems to work? maybe there is another or better way?

VectorCalculations_V4.hipnc

Edited by breadbox
Link to comment
Share on other sites

the centerpoint in VOP was calculated as center of the bounding box, so you will not get exact center of the geometry or at least where you may visually expect it to be

center of the bounding box seems to be what $CEX,Y,Z will give you for point attribute

average of point positions is what you will get when using $CEX, Y, Z for prim attribute, as it seems (and maybe average of such face centroids if there is more prims I guess?)

you can use pointavg() expresion for it as well

but you wouldn't get exact center even from averaging the point positions since that depends on point density/distribution

for this symetrical shape it might be exact center, but for most uneven shapes I think bbox center is better approximation

it doesn't really matter if it's slightly off or not, since the same offset is used for the pivot of the geometry, so it should match the face perfectly however you calculate it, even if it is off the geometry

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...