# Instance orientation

## Recommended Posts

When instancing geometry to points with an instance-sop (so not with a copy-sop) i found on the various forums that you can use point attributes to randomize the instances' scale or rotation.

I've found Wolfwood's post that explains how the attributes are interpreted:

http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&t=6679

So i used an attributecreate-sop to add the orient-attribute that i need and made this a Float size 4 with writing values 0,1,0,and rand(\$PT)*360 to randomize the rotation on the y axis. The orient does not expect a degree value i think because i do not get the randomized y-rotation i was hoping for. Just putting rand(\$PT) in there does have a better effect but the rotation does not seem random, or at least not from 0-360 degrees. What is it expecting? Radians doesn't seem to be the answer because rad(rand(\$PT)*360) does not give a good randomization neither.

How can i get a good distribution of random rotations between 0 and 360 degrees here?

##### Share on other sites

I can't remember what quaternions actually give. They are a bit special, you can even store double rotations in it (2pi). But it's kindly been made palatable for us as a vex, by clever devs.

Edited by Macha
##### Share on other sites

here is a simple example how to randomize orient by randomizing euler angles, look into VOP

orient_variance.hipnc

##### Share on other sites

Thanks guys, a voppop did the trick. I combined the two examples to get a version that fully randomizes yrot (0-360 degrees) and varies the orientation as much as you want.

On a sidenote, i noticed you can limit the threading in the voppop to none or one per proc, etc. How do i figure out if the voppop can fully use all procs/threads in my pc?

orientation_variation_plus_yrot.hipnc

##### Share on other sites

...

On a sidenote, i noticed you can limit the threading in the voppop to none or one per proc, etc. How do i figure out if the voppop can fully use all procs/threads in my pc?

one per proc is actually one per core or thread, don't know exactly, but it should use as much as it can

##### Share on other sites

• 1 year later...

Just a follow up question for Instancing,

Has anyone been able to pass the Instancer Point Attributes for for custom AOVs?

I have already figured out how to assign random shaders per instance (you have to hijack the shop_materialpath attr) but the thing is the instances are not respecting my custom AOVs...

I currently have a POP sim with a number of custom point attributes (with matching parms in the shaders) setup to create custom AOVs. If I use a Copy Sop the AOVs work fine, however when I switch to instancing they don't seem to be recognized.

Anyone have any luck with user AOVs and instancing?

Thanks!!

- N

##### Share on other sites

• 3 years later...

Hi, I appreciate all the examples - they're working fine but with VOPsops. We're supposed to be using Attribute VOPs now and after spending 3 hours on this simple task I just gave up. The randomization is not working. How does one translate the simplest example, from Macha's file, into Attribute VOP? I've attached my attempt and screenshots. Thanks for any help, it's driving me crazy... (I'm still quite new to Houdini).

random_rotation.hipnc

##### Share on other sites

use bind export instead of Add Attribute, that's the most common problem of switching to CVEX, Add Attribute is not meant for the same puropse as in VOP SOP,  you can find plenty of threads about that in here where it's explained

Edited by anim

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

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

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

×
×