Jump to content
yourdaftpunk

trouble displacing curve strips along S direction

Recommended Posts

Hi, I'm getting back into Houdini and I'm starting to explore vex and vops. The first roadblock I've run into is displacing curves. I don't want to displace along the normal, but rather along the s direction which I assume is defined with dPds? Here's an illustration of what I'm trying to accomplish, hopefully the labeling is accurate:

displaced_curve_strip.png

The curve also has UVs, with the u varying from 0 at root to 1 at tip and the v being 0.5 at every point. Generous displacement bound is added to the geo so that's not an issue. I can displace in other ways, and I can shade the curve with dPds (it would render green in this example as the curve strip is exactly on the xy plane), but for some reason I think the dPds vector is coming in all zeros for the displacement calculation.

Thanks.

-shawn

Edited by yourdaftpunk

Share this post


Link to post
Share on other sites

use s and t not dPds and dPdt, they are the derivatives of P along s and t.

Share this post


Link to post
Share on other sites

Thanks for the quick reply! But are s and t not just the two float coords of the surface (much like UVs)? I need to displace in the tangent or bitangent directions and dPds seems to be a vector in the correct direction (going along the width), but it is empty of values when I read it as part of a displacement shader. Maybe a bug?

-shawn

Edited by yourdaftpunk

Share this post


Link to post
Share on other sites

Have you tried toggling on Render -> Dicing -> Shade Curves As Surfaces in the OBJ container?

Share this post


Link to post
Share on other sites

From your diagram above it looks like you want to displace a ribbon along it's u direction and not a curve.

Pretty simple using the PolyFrame SOP which can compute the u and v tangents from a curve or surface. When set to uv's, it creates two vertex type direction vectors for the direction change in u by default in tangentu and for v in tangentv. This means you have to build uv's. If the ribbon is built from curves it's straight forward to create NURBs ribbons and use the UV Texture SOP to build uv's using Uniform UV's.

After computing the tangentu and tangentv vertex attributes, convert to point attributes with the Attribute Promote SOP followed by a VOP SOP and the Displace Along Normal VOP to do the heavy lifting where the normal direction is either tangentu for u displacement or tangentv for v displacement.

See the attached example.

curve1_displace_ribbon.hipnc

Edited by old school
  • Like 1

Share this post


Link to post
Share on other sites

Gracias everyone!

eetu- No effect in my test scene as far as I can tell, but I'll leave it on.

old school- Good example, that's exactly what I was going for, except I wanted to build the strip at rendertime (I have a lot of curves to deal with). I'll save this as my backup.

petz- Wow, that scene is awesome. I think that's exactly what I'm looking for. There's much I don't understand, but I will try and grok it all today. Superb stuff. Also, you're specifying displacement bound in the vop network with a properties node and linking it by expression to the scale factor control for the displacement? Had no idea that was possible! Very cool. And for the displacement vector calculated in vops at shading time, you're taking the cross product of P and dPdt as the direction?

Thanks again gents,

shawn

Share this post


Link to post
Share on other sites

Thanks for the quick reply! But are s and t not just the two float coords of the surface (much like UVs)? I need to displace in the tangent or bitangent directions and dPds seems to be a vector in the correct direction (going along the width), but it is empty of values when I read it as part of a displacement shader. Maybe a bug?

-shawn

Oops, I get it now. You need "shade curves as surfaces" to get dPds to output something ... seems OK for me on 12.0.694.

Check out the attached file, It seems OK but I haven't looked all that closely at it ....

dpds.hip

Edited by sam.h

Share this post


Link to post
Share on other sites
seems OK for me on 12.0.694.

Here's how it's rendering, 12.1.33 on Win 7 x64:

s_curve.png

Shouldn't I be seeing the turbulence displacing here?

-shawn

Share this post


Link to post
Share on other sites

Shouldn't I be seeing the turbulence displacing here?

Works with micropoly rendering, doesn't work with raytrace engine. Hmf.

Share this post


Link to post
Share on other sites

Works with micropoly rendering, doesn't work with raytrace engine. Hmf.

Ha! I was banging my head, feeling sheepish I couldn't work the example. Has that always been the case with dPds/dPdt?

Share this post


Link to post
Share on other sites

Anyone here did have success in displace the ribbon in s?

I am trying to bend it in the middle like a half pipe and I had no success, any ideas?

Edited by Mzigaib

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×