June 10, 2019
Houdini – Polywire and Sweep Nodes
Using with Ramps
By: Saman khorram
I think this tutorial may finally give me my solution to replace my personally made ramped scaling in Houdini for my frog generator with a more consistent and simple SOP setup. I’ve just needed a way to sweep and then scale separately in the horizontal and vertical direction using a ramp along the line of the sweep.
This ended up just being more about altering the pscale along the line. This just alters the uniform scale of the circles.
Current Fix
I was able to change the vex a bit to give me a more consistent result as of now. I am still using a Sweep of circles over a line and scaling them my own way with a bit of vex, but I’ve just changed how it works.
Initially, I was using this on the circle that I was sweeping: vector a = set(0, 0, 0);@N = normalize(a+@P); v@xScalingVector = set(@N.x, 0, 0);v@yScalingVector = set(0, @N.y, 0); I was doing this so that the circles would be able to keep the scaling vector information with them after they were swept to use for the individual axis scaling. This gave me some inconsistent errors though. The body would not be symmetrical, with a bit of a skew.
The scaling was done by using ramps to assign xScale and yScale attribute values to the points of the circle sweep along the path. The scaling was then done with an attribute wrangle and the following VEX: @P.z += @xScale * v@xScalingVector.x;@P.y += @yScale * v@yScalingVector.y; The P.z taking “x” values was because the z values actually dealt with the width of my frog body. This was taking the ramp values and multiplying that with the originally signed scaling vectors and then readding that to the point position. The scaling vector was supposed to help with direction, so the negative values would go more negative and the positive the opposite. However, some points were keeping scaling vector values of the opposite sign, so they would “scale” in the wrong direction and give the weird skew.
While experimenting with some fixes by just using an arc and mirroring it 1 or 2 times, I actually just tried using the normal vectors directly in my wrangle as opposed to the saved values since I thought the saved values may not be working nicely with the curving of my sweep outline. So for the circles pre-sweep, I just kept the initial part of the VEX wrangle: vector a = set(0, 0, 0);@N = normalize(a+@P); And for the scaling wrangle, I just used the @N vector: @P.z += @xScale * @N.z;@P.y += @yScale * @N.y;
So far, this at least fixed the issue for now, and has worked with a few variations so I am hopeful this is a decent fix for my issue for now. Random final note, I did have to reverse the normals after skinning when doing it this way for other nodes to work properly (such as the one protruding the ridges on the frog’s back).