# Resample curve by width/pscale

## Recommended Posts

Anyone know of a simple way to resample a curve by pscale/width attribute - or perhaps another way to space hulls in a sweep or alike by pscale/width so lower numbers will yield higher sampling..?

And the idea is to get more square'ish quads for a setup like this, procedurally...

resample.hiplc

##### Share on other sites

attached is one way how you can do this ...

hth.

petz

Edited by petz
##### Share on other sites

Man, you are brilliant with VEX. Much appreciated.

Here's the direction I went - no clue how I came up with it, my brain is just auto-piloting most of the time, it's more reaction that action - not even kidding. Now, there is a relation to be set up between the pscale, the resample segment amount and the fit min/max to get this working "right" - though so far I have no clue what that formula is, but I'm pretty sure it's there, somewhere...

resample_squares.v1.1.hiplc

##### Share on other sites

what if you simply calculate the circumference and divide it by the number of polywire´s division?

##### Share on other sites

Yeah, I will put this down on paper and see if I can straighten out the relationship, and it's of course based on circumference divided by segments to get the polywire, but with my current solution, I need to resample the curve to fit the overall divisions first, then delete any other points than the segment ones - it's kinda messy, to say the least.  I have a new idea for doing this using a carve in a for loop to generate the points fed into an add SOP to recreate the curve, much cleaner, but I'll dig into that tomorrow - at the earliest.

And just to be clear, if I was in production and had this issue, I'd go for your setup in a second, but as it's more generic, playing around with problem solving (the kinda stuff in the scene files I usually post on Vimeo), so I really want to find something that's easy for ppl to wrap their head around.

##### Share on other sites

Here's another hacky way to do this, abusing a rest attribute to restore point positions after scaling by inverted pscale/resampling. Minimal code at least...

--Dave

resample_withRest_DS.hiplc

##### Share on other sites

Oh, that's really cool, Dave. That's truly my kinda hacktastic solution.

And the Facebook thread on this generated talk about doing this in CHOPs, so hoping for a scene file on that today or tomorrow, then I'm gonna compile the solutions into a list and zip the files for download (or collect them in a single scene file) - always great to be able to look at a different solutions for a problem, see how different people approach it.

##### Share on other sites

Love these explorations! Looking forward to seeing an example of a CHOPs solution, seems ideal for this task.  Need to learn more CHOPs, not enough time in the day...

##### Share on other sites

Absolutely. The differential curve growth thread is a great example on that as well.

And there's a lot more on this subject on the Houdini group at Facebook, in a way kinda sad the know how is so fragmented now, with the Facebook group and the Discord chat/community - forums are truly the best way to do this kinda thing, imo, as Wiki's are the best way to organize and present information - Facebook and Discord is more about the moment, not some great solution from 2 years ago, as I find at OD Force all the time.

##### Share on other sites

• 4 months later...

not very good with VEX so this is done with a relax node and a resample before and after followed by moving the points back to a saved rest point like Dave did. this solution is nice cause i can 'paint' detail in a way... needed it for the below example where i wanted more resolution in a specific area we where the camera would be focusing!

thanks everyone for the tips!

Edited by LorcanOS
##### Share on other sites

• 2 months later...

Funny enough, this was again asked in the Houdini Artists Facebook group and I had completely forgot about asking this back in April... Either way, here's two other SOP based solutions to this problem, the second one a bit of a joke, of course - though I have no doubt that method can be useful for some things as well...

##### Share on other sites

Cool, clever use of foreach and minpos!   Does seem like that could come in handy for other stuff.

Looks like both links point to the same file though?

--Dave

## 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.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×