How does uvsample work?
5077 5 5- Len
- Member
- 132 posts
- Joined: July 2007
- Offline
I'm trying to use uvsample (vex function) to interpolate point positions along a curve based on a custom attribute that I've uniformly added to a non-uniformly-spaced poly line.
I try this:
vector ptPos = uvsample(0, “P”, “myAttrib”, {0.5, 0});
And what I get back is a point position based not on my myAttrib value, but the implicit u coordinates in the curve (which are not length-uniform).
In fact, I can change myAttrib to any string and get the same results. As if it's not seeing my myAttrib point attribute at all. But the geo spreadsheet shows it correctly.
Can anyone tell (or show) me how this is supposed to work? I'm either confused or it's broken (16.0.705 Indie).
Thanks ahead of time!
-Len
I try this:
vector ptPos = uvsample(0, “P”, “myAttrib”, {0.5, 0});
And what I get back is a point position based not on my myAttrib value, but the implicit u coordinates in the curve (which are not length-uniform).
In fact, I can change myAttrib to any string and get the same results. As if it's not seeing my myAttrib point attribute at all. But the geo spreadsheet shows it correctly.
Can anyone tell (or show) me how this is supposed to work? I'm either confused or it's broken (16.0.705 Indie).
Thanks ahead of time!
-Len
- galagast
- Member
- 252 posts
- Joined:
- Offline
Hi, this has got me curious..
I did a some testing, so far it seems that it only *works* with primitives, not curves/polylines.
Have a look at the attached file, hopefully I'm using it correctly.
It would be neat if it didn't snap to the nearest found “P”, but instead should just return an interpolated point position. Maybe the function does have a bug?
H16.0.745 Indie
I did a some testing, so far it seems that it only *works* with primitives, not curves/polylines.
Have a look at the attached file, hopefully I'm using it correctly.
It would be neat if it didn't snap to the nearest found “P”, but instead should just return an interpolated point position. Maybe the function does have a bug?
H16.0.745 Indie
- matthias_k
- Member
- 483 posts
- Joined: Dec. 2006
- Offline
- goldleaf
- Staff
- 4155 posts
- Joined: Sept. 2007
- Offline
You can texture the curves in Rows & Columns mode, then use primuv() [www.sidefx.com] to lookup the interpolated values based on UVs. This example uses VOPs, but the same can be achieved with a wrangle.
Hope that helps!
(edit: didn't see that link in the last post, which is also suggesting primuv!)
Hope that helps!
(edit: didn't see that link in the last post, which is also suggesting primuv!)
Edited by goldleaf - Oct. 25, 2017 21:37:15
I'm o.d.d.
- Len
- Member
- 132 posts
- Joined: July 2007
- Offline
Hey! Thanks for all the ideas and examples.
In terms of the original question: How is upsample intended to work, I think @galagast probably has the real answer, in that it doesn't work for my intended target, polylines.
@goldleaf, your example is very cool but I don't think it gets at the core of what I'm trying to solve: I have non-evenly-sampled polylines (different length segments between points) and want to get points at set distances along the curve from a given point along the curve.
Basically interpolating points but by distance instead of the non-evenly distributed U coordinates that most (or all) of Houdini's tools want to work with.
I've tried setting the u values to be distance-based, but that seems impossible on polylines (discovering along the way the distinct difference between parametric ‘implicit’ u-coordinate and u, in terms of texturing, coordinate).
So I thought, if upsample() lets me use another attribute, besides the non-editable U-coordinate, I can pump it with my correctly-valued attribute (e.g. “distanceAlong” or something like that) and get points at specified distances from any reference point. But, looks like that won't work in this case.
In terms of the original question: How is upsample intended to work, I think @galagast probably has the real answer, in that it doesn't work for my intended target, polylines.
@goldleaf, your example is very cool but I don't think it gets at the core of what I'm trying to solve: I have non-evenly-sampled polylines (different length segments between points) and want to get points at set distances along the curve from a given point along the curve.
Basically interpolating points but by distance instead of the non-evenly distributed U coordinates that most (or all) of Houdini's tools want to work with.
I've tried setting the u values to be distance-based, but that seems impossible on polylines (discovering along the way the distinct difference between parametric ‘implicit’ u-coordinate and u, in terms of texturing, coordinate).
So I thought, if upsample() lets me use another attribute, besides the non-editable U-coordinate, I can pump it with my correctly-valued attribute (e.g. “distanceAlong” or something like that) and get points at specified distances from any reference point. But, looks like that won't work in this case.
- aplus
- Member
- 2 posts
- Joined: Nov. 2014
- Offline
-
- Quick Links