SciMunk Posted November 23, 2018 Share Posted November 23, 2018 Hi, I'm trying to create a fake wind effect for my scattering node and I have trouble with the orient attribute and quaternion, I don't think I fully understand how to use quaternion for my situation : I have a first attribute wrangle who setup my orient attribute for futur point instancing, then to simulate my fake wind, I use a noise offseting in the direction of the wind, I then use this noise value as a force to calculate a new orientation and interpolate the original orient with this one using slrep(), but I get weird glitch weird my my point do a 180° turn in a single frame. I think what I need is not to interpolate the old orient with the new but simply add it up, but I don't know how to do that with quaternion, and how to avoid having the axis flipping issues. I would really appreciate is some matrix pro could help me out with that ! Thanks a lot. untitled.hipnc Quote Link to comment Share on other sites More sharing options...
toadstorm Posted November 24, 2018 Share Posted November 24, 2018 slerp() always finds the shortest path between two orientations, so if it's asked to interpolate past 180 degrees, it'll flip. to "add" quaternions together, what you really want to do is multiply them via the qmultiply() function. i made the change to your "WindSimulation" wrangle. i also centered your noise vector, since otherwise your wind will always lean towards one side. untitled_toadstorm.hipnc Quote Link to comment Share on other sites More sharing options...
A-OC Posted November 24, 2018 Share Posted November 24, 2018 Hey, here's my take. Your scene is pretty intricate so rather than trying to understanding it I made my own version with just a handful of nodes. Hope it helps. untitled_aoc.hipnc Quote Link to comment Share on other sites More sharing options...
SciMunk Posted November 24, 2018 Author Share Posted November 24, 2018 Hi, Thanks for the answer guy ! toadstrom, this work exactly like I wanted, however I'm not sure why simply multiplying the matrix together don't produce the same weird glitch where the original orient do a 180° turn, to me it sound as it do the same thing as the slerp, no ? Also, I think the noise should not be centered as the purpose of the wind is to push the object in a particular direction, but it good to know about it, thanks ! A-OC, I appreciate the try, but my issues was a little bit more tricky than that ! also, I recommend you to have a little look at the foreach used in my scatterer, it is highly unoptimised to use a foreach on every point with a copytopoint node as you get a major loss of performance, the idea is to group each point that will scatter the different object and then do the for-each over each group, reducing the amount of loop needed by only the number of object. Quote Link to comment Share on other sites More sharing options...
toadstorm Posted November 25, 2018 Share Posted November 25, 2018 The reason it isn't flipping is because the wind isn't pushing any of those instances beyond a 180 degree rotation. The first step is multiplying the quaternions together to create the maximum possible rotation, and then THAT quaternion is slerped with the original based on the wind strength. (You could probably simplify this by scaling down the initial quaternion you multiply by and eliminate the slerp() entirely). If the first quaternion there were more than 180 degrees away from the starting position of each instance, you'd probably still get a flip, but the wind doesn't get that strong. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.