Jump to content

random rotation on particles in hou13. How to do it?


Baldric

Recommended Posts

Hello there,

 

can anyone tell me how to set up random rotation of particles in houdini 13?

 

First I would like to have the particles have a random rotation on creation. I haven't been able achieve this in the file attached to this message, so I tried to do this in sops using the copy sop and transform. However, doing this seems to create some weird kind of snapping behaviour. Isn't there a good way of doing this in the particle sim?

 

Second, i would like the particles to have a random rotation over time as well. I've used the torque node for this, but there are some problems. For example, the torque accumulate over time (I think), so it tends to start from a low angular velocity and then goes higher. Attaching a drag fixed the issue of too high speed, but not the issue of too low in the beginning. How can I control this better? And then I tried to use vexpressions, which I know next to nothing about. I seem to only be able to control one of the axis with my expression. Controlling axisx, axisy and axisz failed... What am I doing wrong?

 

I would appreciate any help!

 

Thanks,

 

Doug

particle_rot_problem.hipnc

Link to comment
Share on other sites

Thanks Pazuzu! Really helpful!

 

If you don't mind, can you please tell me a little bit about why you choose to do it this way? Working method-wise... For example why set up the random up vector, if you can bypass it later and still get the same visual result? Is there a good logic reason to do it this way rather than not? And then you set up a pop torque for the z axis before you set up the next poptorque for random rotation - why exactly? I mean, what benefit does this give you that you don't have otherwise?

 

Also, I am still wondering why I cannot set parameters in the torque node for x, y, z separately? For example - something like axisx = 1; will not work. Why is this? 

 

Thanks,

 

Doug

Link to comment
Share on other sites

Hi Doug!

 

Its a multi example file, it contains a few methods to compute rotations, so one torque in one specific axis in the case of "poptorque__z_axis", a random one in "poptorque__rand", and setting up a random up optional vector to use with the initial random rotation in the case of "poplookat__initial_orientation".

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Hallo!

 

I would like to ask few questions, because I'm just learning, and need a little more explanation.

 

 

1. popwrangle__set_rand_up - by @up you change up vector, thus, changing roation.

@up = normalize(set(fit01(rand(@id+455),-1,1),fit01(rand(@id+58),-1,1),fit01(rand(@id+986),-1,1)));

a) why normalize? All values all already by fit01 between 01 value (-1,1, to be precise). From what I understand, normalize takes large numbers and "shrinks" them to between 01. Is it from adding vectors, that if they even have "startup" values of -1,1, they will add and exceed values?

b ) I don't see @up attribute in midde-click-information. only in detail view. Where can I find list of all possible attributes (except of course, custom attribs)?

 

 

2. poplookat__initial_orientation

vector randDir = set(fit01(rand(@id+65),-1,1),fit01(rand(@id+95),-1,1),fit01(rand(@id+245),-1,1));
target = normalize(randDir);

a) first line means: make vector, named randDir, with values xyz between -1,1 (I'm writing this just to be sure I understand it correctly). then.. what "target" does? I can't find this in expression cookbook, or in help. second part is I presume to normalize attrib named randDir. Why there is a must to write it with target. cant I just write "normalize(randDir);"?

b ) how houdini knows that this randDir is supposed to "attach" to orientation value of each particle? Maybe randDir is not a custom name, but a "possible" variable?

 

3. poptorque__z_axis

float sign;
if(rint(rand(@id+5623))<=0.5) sign = -1;
amount *= sign;

I don't understand nothing at all :)... create float named sign, if rint(??), with random id number is less then 0.5, then sign equals to -1... why? some will rotate, some not? or will rotate with -1 value? I only presume that on axis chosen in node.

 

4. poptorque__rand

axis = normalize(set(fit01(rand(@id+65),-1,1),fit01(rand(@id+95),-1,1),fit01(rand(@id+245),-1,1)));
amount *= fit01(rand(@id+44730),-1,1);

a) random axis... understand that.

b ) "amount *=" mean multiply... by amount... random number... per particle. Why? Why not "amount *= axis" - wouldn't that multiply axis values by amount making them spin faster? I understand that right now, amount is multipling axis by random -1,1 values, so... if particle 1 is spinning in positive direction, it can be multiplied by -1 and rotate opposite. Or something.

 

 

 

 

5. Why all of the spinning nodes are speeding up without popdragspin?

 

 

I'm very sorry, that I probably ask stupid questions, but I'm not good at this stuff and try to learn a little :)

Edited by ChargingImage
Link to comment
Share on other sites

  • 6 months later...

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