Jump to content
Symbolic

"orient" attribute and the copy SOP

Recommended Posts

Hi,

I have a wire animation coming from a wire simulation. I am trying to copy objects on to the points of the wire. I can see the orient attribute on the points, but the geometry that I copy on the wire points does not seem to rotate and follow.

any ideas, thanks!

Share this post


Link to post
Share on other sites

Actually all of this is related to a wire simulation that I am trying to setup.

Sorry for my bad drawings, But it is something like that:

post-1724-127759154391_thumb.jpg

So I have a backbone, that will be a wire... And then I have secondary branches that will be wires as well. I could not find a way of setting up multiple wire constrains. So for this reason I decided to split this in two parts. First simulate the backbone.

So it looks ok:

post-1724-127759198929_thumb.jpg

But then when copy something on that curve, it does not orient properly:

post-1724-127759215697_thumb.jpg

Because at this stage I need to run a second sim on the secondary branches which work as well, it is only that orientation problem that messes up things. I tried the Up vector thing, tangents etc. Also, there is an orient attribute on those curves that should be working...

Any ideas? Thanks.

Edited by Symbolic

Share this post


Link to post
Share on other sites

example file attached!

petz

Wow petz! Thanks man! I did not understand your CHOPs approach (not very good in chops - need to study your file when I have time) but quickly put a VOPSOP with some cross product stuff in it and a simple way to calcualte tangents. It works. Thanks! And yeah... I am deleting that "orient" attribute, it is crap for some reason and overrides my N and up attributes.

Share this post


Link to post
Share on other sites

Hey Petz, this is interesting. Did I just witness you perform deep dark and magical vector-calculus wizardry in that CHOP?

It never occured to me we could use CHOPs like that but now after seeing this it seems such a natural thing to use it for.

Share this post


Link to post
Share on other sites

The Vector CHOP is definitely awesome. It was added into Houdini 10.0.473 back at the end of November. It was originally added in what's now Houdini 11, but was put into 10.0 a while later. It kind of just snuck in there so not a lot of people know its there, but it is really useful.

Share this post


Link to post
Share on other sites

Yes, very cool trick with CHOPS, long time ago i was making such things with expressions, but now i prefer VOPS for that. But i have a question. In Copy SOP, normal attribute of a template geometry used to calculate orientation of copied geometry right? What if my normal is already "busy", i mean, i cant touch them, but i have my custom vector attr, and i want to use it in copy SOP, instead of N. Is it possible? Thanks.

Share this post


Link to post
Share on other sites

The copy SOP will use the 'orient' attribute if it exists and then fall back on N, up and v if there is no orient attribute. If your N is already spoken for then you'll need to convert your vector into a quaternion and call that 'orient'.

Cheers

Marc

Share this post


Link to post
Share on other sites
What if my normal is already "busy", i mean, i cant touch them, but i have my custom vector attr, and i want to use it in copy SOP, instead of N. Is it possible? Thanks.

You can use an orient quaternion side by side with the normal. I attached a file. There's a problem with the rotation speed but you can fix it with a simple trig expression, I forgot how though, it's mentioned somewhere on odforce.

But I would be tempted to use different attributes if your normal attribute is already used. Or, you could copy or transfer it back to the geometry afterwards. It depends on the setup I guess.

Btw, I have a hunch that the CHOP magic above is much deeper, darker and more subtle than you could do in VOPs. Quite beautiful actually, I'm all excited. *cδugh*

orient.hipnc

Edited by Macha

Share this post


Link to post
Share on other sites

Thanks guys, i just simply have not considered, that my orient attr needs to be quaternion instead of just vector3 :) Now everything works fine.Thx.

Edited by Stalkerx777

Share this post


Link to post
Share on other sites

The copy SOP used to use the 'rot' attribute from pops, but at some point they changed it without telling anyone ;) (ok, they may have told people, but I had to learn the hard way).

Share this post


Link to post
Share on other sites

Thanks to everyone. CopySOP has always been one of the most powerful but still very unpredictable one as well. I still think that something is wrong either with the "orient" coming from the wire simulation or in general, because the copied instances just do not align properly when "orient" is around, only after "orient" is deleted and proper N and Up is introduced.

Share this post


Link to post
Share on other sites

Thanks to everyone. CopySOP has always been one of the most powerful but still very unpredictable one as well. I still think that something is wrong either with the "orient" coming from the wire simulation or in general, because the copied instances just do not align properly when "orient" is around, only after "orient" is deleted and proper N and Up is introduced.

No, actually everything fine with copy SOP. Your orient attr didn't work because.... well its not that "orient" attr, copy sop expecting for. I think build-in methods of this sop, can automatically handle conversion from simple vector3 attribute, to vector4 quaternion rotations, and by default, this conversion applied automatically to attributes "N" and "rot" (As Marc mentioned before). "up" vector is just vector3. And if you want to feed your "orient" to copy SOP, (thats why i created this topic), you need to calculate this attribute as quaternions in VOPS.

Share this post


Link to post
Share on other sites

Hey Petz, this is interesting. Did I just witness you perform deep dark and magical vector-calculus wizardry in that CHOP?

oh, nothing magical happens there. for computing a TNB-frame you need to take the first and second derivative of the curve and thats exactly what the slope-chop is doing. the vector-chop is then used to compute the cross product and normalizing the vectors.

more or less the same can be done using "primduv" but by reason of some rounding issues with densely resampled curves chops seems to be much better.

petz

Share this post


Link to post
Share on other sites

oh, nothing magical happens there. for computing a TNB-frame you need to take the first and second derivative of the curve

Oh it's magical enough for me. I've already had wild wet dreams of torsion attributes and Ricci flows.

Share this post


Link to post
Share on other sites

No, actually everything fine with copy SOP. Your orient attr didn't work because.... well its not that "orient" attr, copy sop expecting for. I think build-in methods of this sop, can automatically handle conversion from simple vector3 attribute, to vector4 quaternion rotations, and by default, this conversion applied automatically to attributes "N" and "rot" (As Marc mentioned before). "up" vector is just vector3. And if you want to feed your "orient" to copy SOP, (thats why i created this topic), you need to calculate this attribute as quaternions in VOPS.

Well, It is the "orient" coming from DOPs wire simulation, something is broken there for sure, it is quaternion as well. Anyway. I just found my self diving into matrix calculations and rotations etc. I will do it brute-force... calculating everything by my self :)

Thanks for the tips and the examples.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×