The ability to compose complex rotation out of small knowable components of rotation is a really powerful concept. ![]() ![]() Vector4 target, base vector axis float seed, blend axis = chv ( 'axis' ) axis = normalize ( axis ) seed = noise ( P + Time ) seed = chramp ( 'noise_rerange', seed ) axis *= trunc ( seed * 4 ) * $PI / 2 target = quaternion ( axis ) base = * curlnoise ( P + Time * 0.2 )) orient = qmultiply ( orient, extrarot ) orient = qmultiply ( orient, talktalk ) orient = qmultiply ( orient, wobble ) Īnd so on. Say you had 2 quaternions, and you want to blend from one to the other. A better reason is that there's several helper functions quaternions have that aren't easily matched by other rotation methods. One reason is that we now have a standard rotation format, so there's less chance that you'll be stuck when you have a part of your setup using and others using euler rotations. You might have a voice at the back of your head whispering 'Yeah but. So now we've covered hopefully every way you might have stored rotation and how to convert it to a quaternion. 0 tells it to work in XYZ order, which normally works as you expect. The second variable (the 0) is to tell it what order to apply the rotations in, XYZ, YZX, ZXY etc. So we have a chv to give an interface to the user, convert from degrees to radians with the radians function, then pass that vector to eulertoquaternion. Vector rot = radians ( chv ( 'euler' )) orient = eulertoquaternion ( rot, 0 ) Įuler rotations can be described in radians too, and thats what this function expects (which caught me out the first time I used it). Here, I might also make directly affect to see how far they bob up and down, thus giving me an idea of how the rotation is being affected: So while here I was able to sort the data in the spreadsheet, other times its easier to see the attributes moving things around, or setting colours, or whatever is relevant to your case. In this case by doing so you're biasing the likelihood of which values will get passed onto the rotation an even spread of 0 1 2 3, or mainly 0 and 1, or exclusively 3, or you could put more points in the ramp to make it skip the values 2 altogether. Move the range overall towards the left, you're effectively making most of the image dark, move it all to the right, you're making most of the image light. You can think of moving the points of the ramp around like adjusting the brightness and contrast of an image put the start and end points close together, you're increasing contrast. Vector axis axis = chv ( 'axis' ) axis = normalize ( axis ) a = noise ( P + Time ) a = chramp ( 'noise_rerange', a ) axis *= trunc ( a * 4 ) * $PI / 2 orient = quaternion ( axis ) The numbers themselves are gobbledygook for the most part, the only time I recognise what an orient is doing is when its at no rotation the local x/y/z of each copy matches to the world xyz: Orient is a 4 value vector, so it's nice and compact to store. The reason is that its the most unambiguous way to define rotation. That means it takes priority over everything else. On the instance attributes page you'll see that orient is at the top of the list. This is probably gonna be way over 30 mins today, but I think it's useful to have all the orient related stuff on a single page. So some of this intro stuff you'll have to take on faith, I'll explain details later. When I came back to it via Houdini and instance attributes, I took some advice from Matt Ebb don't try and understand whats happening under the hood, just care about the end result, and what it can do for you. ![]() Or is it? When I first heard about quaternions many years before getting into Houdini, I tried to understand the maths and got myself hopelessly confused, gave up. There's another way to do this, which involves jumping to scary quaternion land, 4 dimensional values, unintuitive concepts. In the previous lesson we went learned how you can use and to define a stable rotation.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |