Jump to content

fixed length curve, where to start


Recommended Posts

I'm wondering if someone could provide a sort of learning road map if I wanted to create a node that is similar to a fixed length curve in maya (you can pull on the last point, and all previous points will adjust to keep the curve at a fixed length). I have some programming/scripting knowledge, and only a little houdini knowledge. Perhaps this can even be created with a dops network, I don't know. I just want to be able to use it real time, interactively. We have a proprietary tool here at work for fur and the curves have locked length so its easy to edit groom (just grab the end and pull it around), I would just like to have the same tool in houdini. Anyways, I'd appreciate it if someone could tell me how they would tackle this project, thanks.

  • Downvote 1
Link to comment
Share on other sites

I'm wondering if someone could provide a sort of learning road map if I wanted to create a node that is similar to a fixed length curve in maya (you can pull on the last point, and all previous points will adjust to keep the curve at a fixed length). I have some programming/scripting knowledge, and only a little houdini knowledge. Perhaps this can even be created with a dops network, I don't know. I just want to be able to use it real time, interactively. We have a proprietary tool here at work for fur and the curves have locked length so its easy to edit groom (just grab the end and pull it around), I would just like to have the same tool in houdini. Anyways, I'd appreciate it if someone could tell me how they would tackle this project, thanks.

The resample SOP can already do this. Give it 'max segment length' of const_hair_length/num_segs_in_hair, and a 'maximum segments' of num_segs_in_hair.

If you really wanted to roll your own, though, GU_Resample is your friend:

const unsigned constLength = 1;

// pre-pack array of prims since gu_resample modifies the gdp as we go.
UT_PtrArray<GEO_Primitive*> prims;
GEO_Primitive* prim;
FOR_ALL_PRIMITIVES(gdp, prim)
  prims.append(prim);

GU_Resample resampler;
resampler.setLength(constLength);
for(unsigned i = 0; i < prims.entries(); ++i)
{
  GEO_Primitive* const thisPrim = prims[i];
  GEO_PrimPoly* resampledPrim = resampler.resampleFace(dynamic_cast<GEO_PrimPoly*>(thisPrim)); // obviously you should make sure it really is a primpoly first...

  gdp->deletePrimitive(*thisPrim);
}

Rough, but something like that can achieve the same effect.

Edited by Vormav
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...