Jump to content

Carve Line by UV Attribute (not parametric uvs)


MildlyRedBeard

Recommended Posts

No one's asked for this (as far as I'm aware) but I thought I'd share anyway. Its a real basic method of carving a poly line base off of a uv attribute INSTEAD of using parametric uvs. This has the nice advantage of 1) allowing for all lines to grow at the same speed and 2) allowing for super easy adjustments, offsets and what not just by modifying the attribute. I wanted to share because I couldn't really find a simple way of doing this. All the other methods demanded parametric uvs. Not sure if I've missed something super obvious but wanted to share anyway. Hopefully there's something in here that'll help someone.

carveuvattr.gif.76c664859ec82612c39809e5c5b980dc.gif

carve_by_uv_attribute.hipnc

  • Like 2
Link to comment
Share on other sites

I think you could also run this in a primitive wrangle:

#include <groom.h>
float dist = chf('distance');
float perimeter = primintrinsic(0, 'measuredperimeter', i@primnum);
float dist_cut = clamp(dist, 0.0, perimeter);
adjustPrimLength(0, i@primnum, perimeter, dist_cut);

@mawi originally came up with this here: https://forums.odforce.net/topic/19626-carving-multiple-curves-by-attribute-hip-file-attached/

 

grow_curves.hipnc

Link to comment
Share on other sites

32 minutes ago, anim said:

I'd say Clip SOP is pretty nonvexy, also should be much faster than foreach carve

https://forums.odforce.net/topic/45517-carve-line-by-uv-attribute-not-parametric-uvs/?tab=comments#comment-213572

 

yeah but yours still requires a bit of brain power to understand tho...while mine is a NO brainer :blink:

Link to comment
Share on other sites

I guess most tds have created their own solutions and its a shame that the carve doesnt support per prim attributes for carving, and when i first started using houdini i remember that was frustrating. I guess thats also why it became one of my first otl/hda aswell.

I first started using the primuv function, but as stated here, when curves have uneven segment-lengths the result doesnt look that great. So uvsample is the way to go in my opinion. Havent tried the clip approach, so its hard to compare speeds in a good way. 

So i put up a test with default clip, no other magic and compared. In my test i had two clip nodes, i guess you can get away with one and get some speed there.

 clip_vs_multicarve.png.10b19fd798231ca1066bee9de0494fac.png Clip wins if i delete points and transfer attributes.

clip_vs_multicarve_nondelete.png.2dab7cefa8c5872181d963c3f1aa10f9.png If i dont delete points or transfer attributes i get a good increase in speed. But i guess clip would be faster with only one clipnode instead of two.

So if somebody have created a good clip carve, it would be nice to compare speed. 

carve_vs_clip.thumb.gif.8e157db8bd221c10aff02d98afd4956d.gif

Clip_vs_Carve_01.hiplc

Link to comment
Share on other sites

3 hours ago, Aizatulin said:

And why not just using @curveu from resample for the clip method (similar to anims examples)?

clip_carve.hipnc

Because curveu doesnt give a precise value when created by a resample sop. It works best when all the points have an even distribution, but still then it would be "incorrect" in the ends because of the even last segment. You dont have to resample with the resample node, you can just generate curveu if you want. So if you try with a curve that have uneven length between the points, you would see that your carving is "jumping" up and down in speed. This would be solved by making a curveu value that has the correct length between the points. Even in Anims case that would fix the uneven carve. But that example doesnt include carving a curve from both ends, and i guess its just pushing the other end of the curve down into the clip plane. 

 

Here i compare it to the carve-sop that use parametric-uvs. The same problem will occure with the @curveu attribute created by the resample-sop.

Top is carve-sop, the bottom is carveing with uvsample.

uneven_lengths.thumb.gif.dad4ffff89c5d3a9518edfed220c6c0a.gif

Link to comment
Share on other sites

On 10.4.2020 at 6:32 PM, konstantin magnus said:

I too was fiddling around with primuvconvert() a bit. But how would you do the actual cutting?

please take a look at the attached file. one example is using primuvconvert() to cut by distance the other is using an attribute.
i didn’t do much testing but it should be relatively fast.

hth.
petz

cut_curve.hipnc

Edited by petz
  • Like 2
  • Thanks 1
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

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

×
×
  • Create New...