Jump to content

How to align rotation axes to a plane's normal


Recommended Posts

Hello Odpeople

 

I have to create a simplified, very simplified, Mystique effect. I have this column covered with little tiles that need to flip 180 to reveal their backface. The tiles need to flip gradually from the bottom to the top.

I've created the tiled in Maya, laid down the uvs and imported the Obj in Houdini.

 

My idea was to isolate every tile with an assemble SOP and a foreach by name, and then drive the rotation according to a sphere animated on TY which will transfer an attribute to the tiles.

 

The problem is that when i go into the foreach node, the single tile rotation axes are aligned to the world, and i would like to align the Z axis to the face normals, so i can drive the X rotation to do the flip thing.

 

What i did so far is to create a point in the centroid of the tile, create a normal aligned to the Z axis and find the rotation angle to align the point normal to the tile normal via POINT VOP, store the angle in an attribute called align and use $ALIGN to the y rotation of the following transform node. From here i'm stuck...i could parent the tile to the point, but i have no idea how, and although the maths in the point vop should be correct, the point is slightly off from the normals.

 

I know there are other ways to achieve the same effect, but i'm curious to see if there is a way to solve this specific problem.

 

thanks for all your help!

rotationAxes.hipnc

Link to comment
Share on other sites

Had a look, unfortunately I couldn't quite follow your thinking in the for-each block. I know you wanted to see if it your method was possible, could you maybe add in some sticky notes to represent the steps of what you want to do? 

 

Anyway, I'd attempted something similar with vops not too long ago, but that was with just each individual polygon moving, not a specific shape as you have here. Seemed a good exercise to rework it.

 

I enabled 'create packed geometry', on the assemble sop, so each tile is represented by a point. I then transfer the normals, and do the rotation in a point vop.

 

The network looks at the normal, runs a cross-product with (0,1,0) to create the correct perpendicular rotation axis, creates a rotation matrix, and sets it as the packed primitive intrinsic transform. I also set the intrinsic pivot to make the rotation be slightly offset.

 

The packed intrinsic stuff is always a little obtuse at first, I have to trawl odforce a few times to get the answers I need, but its worth it in terms of performance. Whenever I see for-each loops, point and transform sops with hscript expressions, I start to get worried... :)

 

post-7292-0-54959100-1440256062_thumb.gi

(click to play)

 

rotate_packed_prims.hipnc

Edited by mestela
Link to comment
Share on other sites

Thanks Matt,

your solution works, i'm having a look at it right now.

I just need to find a more flexible way to activate the flipping, using a geometry seems to me the easiest way to create whatever flipping pattern i want.

 

i'll see if i can adapt it to your scene

 

thanks for your help!

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...