Change a curve intrinsic uv or basis in VEX?

   6927   11   4
User Avatar
Member
361 posts
Joined: 6月 2013
Online
I'm dealing with curve sampling these days to define sections of a curve and how it deforms geometry. While I'm able to work around setting up some individual functionalities with Resample, uvsample() and binary search to manipulate point positions or uvs attributes that support them; when assembling multiple functionalities it becomes hard to account for each one's constraints or requisites.

Fixed uniform distribution between bezier CPs.

Geometry sliding over a CP but constrained to another one.

Different CP types, like Max: Bezier, Smooth and Corner.


So right now, the resource I'm missing to deal with such assembly is the ability to set the intrinsic uv that is gathered by xyzdist(), in VEX. Such is not possible, if I'm seeing correctly that those prim intrinsics are not editable:




I can use indeed the Basis SOP to read the current basis and then edit what I want. I guess I could even pass a detail attribute to this field with a string generated in VEX… But not the most procedural way and doesn't allow specification per primitive.



Another resource I'm missing is to get a points' uv intrinsic on a prim. The default answer seems to be to use xyzdist() or uvsample() (which wraps xyzdist if I understand correctly), but to avoid it I for now, use a UV Texture SOP set to Average Spline, and that seems to return the point's prim intrinsic uv.

Anyone else been through these? I'm pushing the most I can but facing some hurdles. RFE time?

Thanks
Edited by probiner - 2019年2月19日 12:03:38
User Avatar
Member
12 posts
Joined: 11月 2018
Offline
This looks awesome! May I ask for those scene files?
User Avatar
Member
459 posts
Joined: 10月 2011
Offline
I dont think your list array will be updated inside the same wrangle you are manipulation it in. f@foo will return list from line one. What happens if you turn list into an attribute and read it in a new wrangle downstream?

-b
http://www.racecar.no [www.racecar.no]
User Avatar
Member
493 posts
Joined: 7月 2005
Offline
Hi,

it seems, that “setprimintrinsic” is not working (even if you are using another wrangle). Perhaps there is way to modify the intrinsic attributes, but I don't know. “setprimintrinsic” is not working for the knots of NURBS curves. I'm wondering that are no intrinsic weights for NURBS. If there would be a way to modify both … .

On the other hand it will be probably nice, if there is an automatic/instant update function for the “detail”-wrangle (not the others). So if you are applying an add/set function, the wrangle will directly store the information. This may help you, if you are addings geoemtry to an existing geometry and gaining access to the attributes in the same wrangle aswell. Now it is impossible to do that and the only workaround is using a foreach from outside (perhaps someone has an idea for a better workaround).

Attachments:
setprimintrinsic.hipnc (72.0 KB)

User Avatar
Member
2120 posts
Joined: 9月 2015
Offline
If what your trying to do is control the ‘handle’ values of each curve so that, for example in one case, you want the curves of each separate joining tangently;

You can use the vex spline function.

In the form:

vector  spline(string basis, float sample_pos, vector value1, vector value2, vector value3, vector value4)

value1 represents the starting handle while value4 is the last handle.

value2 and value 3 and the starting/ending positions respectively.

To get each line to be tangent to each other the corresponding handle values have to be the same, with one being opposite in value.

Attached file does this with the y components being opposite values through relative channel references negated.

You can also control your own sampling.

With such a vex function you can create how the lines connect/join/behave to each other and are controlled simply by writing your own functions to control the lines.

I don't know much python; But maybe its' possible to add some UI viewport controls with the vex to get the same user interface controlling like in other programs?

But at least in terms of end results, it's certainly possible with the vex spline function and your own tools created with it.

Attachments:
vex polyspline.hiplc (85.5 KB)

User Avatar
Member
493 posts
Joined: 7月 2005
Offline
yes you can use the spline() function, but afaik there is no support for intrinsic knots (or even weights). NURBS curves should take both inputs.

There is an algorithm called “De Boor”, which can be used to calculate NURBS curves. You'll find many references and it is not hard to implement, but it would be nice, if there was an inbuild VEX function to do that.

Attachments:
deBoorTest.hipnc (86.0 KB)

User Avatar
Member
2120 posts
Joined: 9月 2015
Offline
yes you can use the spline() function, but afaik there is no support for intrinsic knots (or even weights). NURBS curves should take both inputs.

You don't need ‘support’ for ‘intrinsic knots’.

You have all the control you need inherent with the spline function arguments to get any curve shape desired;

Including the behavior shown by the OP in the image “Different CP types, like Max: Bezier, Smooth and Corner.” - save the direct in viewport control of which I don't know how to implement. But with user created parms - yes.
Edited by BabaJ - 2019年4月7日 13:28:16
User Avatar
Member
493 posts
Joined: 7月 2005
Offline
For the most cases you don't need knots or weights for sure. But if you want real NURBS you need them. For example you can create a circle with NURBS(degree=2) with 9 points setting the right weights and knots (check the example from my previous post).

I don't know for what Pedro need the knots, if he don't want to influence the curve itself, but the tool looks already nice.
User Avatar
Member
2120 posts
Joined: 9月 2015
Offline
Yeah…I'm not sure what the original poster was actually going for.

But from the pics alone I saw an ‘issue’ with using the curve sop in that it is cumbersome to isolate the control handles from the Coordinate Parameter list of values to change them if one wants tangency at certain points along the way, or break them if you want as well.

One would have to parse the Coordinate Parameter and re-enter it after you do your function on it( haven't tried but might get recursive issues on it too with the same sop your working from). Doesn't help either that it is in a string format to begin with.

This is why I suggested the spline function, much easier to work with. Of course its' issue is the lack of (as I said before maybe possible utilizing python or even through HDK) UI viewport controls, compared to ‘clunky’ user defined parameter controls.

Not sure what you mean by ‘real’ NURBS, as one could simply drop down a Convert SOP after creating the spline.

Unless of course you mean to say the manner in which one is creating the nurbs curve to begin with as in your example;

Which by the way, thanks for posting. That's a nifty approach of which I've saved for reference. Could come in handy sometime.
User Avatar
Member
493 posts
Joined: 7月 2005
Offline
Yes you can use the convert sop, but even with this I have no idea to change the weights or knots.
I think in 3ds max it is possible to change the weights for each control point using NURBS, but I'm not sure if you can change the knots aswell.
Perhaps it is possible in houdini, but I have really no idea to do this.

Of course houdini NURBS is real NURBS too, but it should be possible (imho), to have influence on these parameters, because in other cases you will usually have good control over the parameters in Houdini (if not even the best compared to other programs).
User Avatar
Member
159 posts
Joined: 2月 2018
Offline
I've been waiting for a better Curve tool for a long time. I hope the Curve tool will be as good as C4D one in UX but I guess it won't happen in a short time.
User Avatar
Member
361 posts
Joined: 6月 2013
Online
Just wanted to necropost here with a follow up.

The new function primuvconvert() although slow, it solves some of the issues I was having by allowing me to sample a curve linearly without worrying about it's bias.

Thanks
Edited by probiner - 2020年9月15日 10:47:51
  • Quick Links