Atom Posted July 8, 2015 Share Posted July 8, 2015 (edited) Hi All, I realize this is a simple question but I just can't figure it out. I have an attribute called "uv_xscale" that is being generated but a PointWrangle. This makes it a point based attribute. Later down stream I have a UV Texture node that I want to drive with that value. What do I type in the Scale (su) U parameter to link that field with the value in the attribute? I have tried $ with capitial letters $UV_XSCALE but that does not work. I have tried ch("uv_scale") but that does not work either. What is the HScript code for referencing variables in a field? Edited July 9, 2015 by Atom Quote Link to comment Share on other sites More sharing options...
Rainroom Posted July 9, 2015 Share Posted July 9, 2015 use the point() function to call in the value from the desired point. Quote Link to comment Share on other sites More sharing options...
Atom Posted July 9, 2015 Author Share Posted July 9, 2015 (edited) I did come across a reference to the point function but I am having trouble configuring it for my object. I am attaching my scene. Basically I have attribVOP measuring the length of the line and that greyscale data is stored in $CR. I also have pointWrangle that is creating a new value based upon the contents of $CR. This new value is a scale value that I want to apply to the Transform UV node, further down the path. The net result is that the tube will have one UV scale on one half and another UV scale on the other. This is followed up by a displace that references those UV values. The point function requires a point index to fetch the attribute from. All I have is $CR. How do I convert the $CR information into an index for the expression? ap_displace_tube_test_cable_1a.hipnc Edited July 9, 2015 by Atom Quote Link to comment Share on other sites More sharing options...
jim c Posted July 9, 2015 Share Posted July 9, 2015 If you have a Cd (or color attribute) defined at the point class level, then all you'd need to use is $CR, since that's evaluated at the point level (assuming of course that the SOP in question is working on points and not prims, depends on the SOP). You could bypass the point expression altogether. Otherwise just use the $PT variable as you point num that you feed into the point() expression. If $PT doesn't work then that suggests that the SOP isn't designed to work at the point level, and you might need to get a little more creative. Quote Link to comment Share on other sites More sharing options...
Robert Posted July 9, 2015 Share Posted July 9, 2015 The x scale in the UV texture node is a global scale. It stretches your UV's from 0..1 to 0..xscale. It's a bit hard to imagine what this would look like on a per-point basis. If you want to shrink or stretch a segment somewhere in the middle of your curve the rest that comes after it has to somehow shrink/stretch with it. Just a few remarks on your current setup, the ends node was added to "disconnect" the first and last point of the circle so that the UV's don't wrap to create the stretching that occurs with point UV's, it has nothing to do with the perimeter measurement. Second, the uvtexture nodes before the sweep were set up to automatically UV the skinned tube as a product of its profile and backbone, adding another uvtexture right after it renders that process useless. I'm not saying you can't put a uvtexture after your sweep but just realize that you might just as well remove the setup from before the sweep Quote Link to comment Share on other sites More sharing options...
Atom Posted July 9, 2015 Author Share Posted July 9, 2015 I did try $PT, and I could not get it to work. For some reason the scope/context changes after the sweep and the $PT variable is not accepted by the point() function. And I think it is because I am supposed to be passing an integer index not a float between 0.0-1.0. So maybe some modulus function that returns an integer based upon $PT and $NPT is needed? Here is the goal, however. Imagine the displacement is just a checkerboard. We would get even tilable displacement along the length of the tube. What I want to do is to chop the length into n segments and apply different UV scale values to each segment. The visual appearance would show different scales at different segments of the curve. I thought if I could scale the UVs based upon the length that the displacement would simply follow along? Quote Link to comment Share on other sites More sharing options...
Robert Posted July 9, 2015 Share Posted July 9, 2015 You can try to carve your curve into multiple segments and then loop through them to use the uvtexture node with a separate scale. If you give each piece of the curve the new scale attribute you can reference it using the prim() expression inside your loop. When local variables aren't supported it usually means the SOP doesn't operate on that context. After using wrangles and/or vops you tend to get spoiled and forget that not many nodes loop over all points by themselves to allow the use of $PT to get the current processed point. Quote Link to comment Share on other sites More sharing options...
Atom Posted July 9, 2015 Author Share Posted July 9, 2015 (edited) I think I see what you mean. The UV Texture simply can not be driven that way. But after an afternoon of noodling I did come up with a solution that matches my original intent. I still use the UV Texture but set it's scale to 1.0 for all axis. Then I follow that up with a FOREACH with a point wrangle inside. The point wrangle scales the existing UVs by some constant values that are determined by a series of IF/THEN statements. The IF/THEN statements are driven by the percentage along the path, which is stored in $CR. I added a different color in each IF/THEN so I could see what sections were receiving what scale values. ap_displace_tube_simple_1a.hipnc Edited July 9, 2015 by Atom Quote Link to comment Share on other sites More sharing options...
cojoMan Posted August 13, 2015 Share Posted August 13, 2015 instead of your multiple if statements why don't you use a float ramp for each of the uv.x and uv.y values ? should do the same thing (but be more artistic driven, and more flexible than hard coded values) especially if the input is normalised... 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.