Jump to content

normalizing and "unnormalizing" transform


gronk33

Recommended Posts

Hi there,

I’m trying to move a shape to the origin, project uvs and then move it back to its original position. I’m actually using a technique from Kim Goossen’s excellent Procedural Roads I tutorial on CMIVFX. However it’s not working. Nor does it work in the project files I downloaded as part of the course.

Simply, I’m adding a transform node to my shape (call it transform1 for this example) and entering the following in tx, ty, and tz:

-$CEX, -$CEY, -$CEZ

This moves the circle to the origin no matter where it was in world space and allows me to project uvs easily.

When I want to move my circle back to its original position I add a transform node after the projectuvs node. In the tx, ty, and tz parameters I enter:

-ch(“../transform1/tx”), -ch(“../transform1/ty”), -ch(“../transform1/tz”)

However it doesn’t work and my circle stays at the origin. I’ve attached my file if anyone has the time to offer suggestions.

Thanks in advance!

post-8066-0-45513700-1370202054_thumb.jp

post-8066-0-96912100-1370202067_thumb.jp

post-8066-0-29196600-1370202079_thumb.jp

normalizeTest.hipnc

Link to comment
Share on other sites

you're right, it seems to be broken in current versions of Houdini

$CEX, Y, Z used to give the actual value back to parameter so it can be referenced

now it just using them internally and puts 0 in parameters which is very bad and it's probably breaking lot's of HDAs

you can use centroid() function instead which should work

Link to comment
Share on other sites

You guys are great. Thanks for the fast reply. As mantragora demonstrates, centroid() in the pivot parameter works perfectly.

Now my challenge is to normalize and unnormalize scaling. I'm using the following if statement in my scale parameters for the first transform:

1/if($SIZEZ>if($SIZEX>$SIZEY,$SIZEX,$SIZEY),$SIZEZ,if($SIZEX>$SIZEY,$SIZEX,$SIZEY))

It doesn't seem to be working as it should. It works when I use $CEX, $CEY and $CEZ in the transforms...

But because of the value in the pivot (I think) it's not scaling around the center of the object. Second, like $CEX it seems to be broken and doesn't return anything but zero.

I've attached a modified version of mantragora's file with a second branch where I try to normalize and unnormalize the scale.

Thanks again if you've got any advice!

P.S. I thought I was going crazy with the $CEX-not-returning-a-value problem. Anim, thanks for verifying that it's broken.

I_Prefer_To_Do_It_This_Way_with_scale.hipnc

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