nanocell Posted July 22, 2009 Share Posted July 22, 2009 (edited) Greetings! In response to the following post on the Houdini mailing list: I have particles which a being copied as flowerpetals (sections of spheres with a shader using alphas to look like petals. They look great unless one rotates to the side. I think I can use the up vector in a point sop to fix this, but I am stumped on how. Basically, I want to use some sort of smooth function to nudge the rotation of individual points based on whether they are approaching the normal being perpendicular to the line of the camera direction. Any suggestions? Grav I found this problem intriguing (having wanted to do this before myself), and build a little VOP/POP system to achieve this effect (see the attached .hip file). This was built using Houdini 10.0.320 (meaning I'm not sure whether the .hip file will work with Houdini 9.5). The idea behind this solution, for the more mathematically inclined, is to utilise the Dot product (also known as the Scalar product) to calculate a nudge factor (The nudge factor, a value between -1 and 1) that will be used to rotate the particle away from a certain point, called the Repel point. There are three important axes involved in this little computation. A "facing axis" (which is axis that will be pushed away from the repel point; x-axis by default), a "nudge direction axis" (which will be used to determine the sign of the nudge factor; z-axis by default), and the actual rotation axis (the axis around which the particle will rotate, using the nudge factor; y-axis by default). All three axes are specified in particle space, for ease of use. One other import vector is the direction vector from the current particle to the repel point (let's call this vector "R"). The nudge factor is calulcated as follows: (Note that I left out some space transformations to keep the explanation simple...all the vectors discussed below are now object space) nudge = clamp(dot(R,facing_axis), 0, 1) // this is the "unsigned" nudge factor; value between 0 and 1 The sign of the nudge is determined using the "sign" function that returns +1 if its argument is positive and -1 if its argument is negative: nudge = nudge * sign( dot(R,direction_axis) ) // apply a sign to the nudge factor; value between -1 and 1 The reason that a sign is ap particle_nudge25.hip Edited July 22, 2009 by nanocell 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.