Camera independent hair tangent

   3297   3   1
User Avatar
Member
22 posts
Joined: June 2008
Offline
I'm rendering hair attached to some poly surface.

Use the following to get hair tangent direction:
vector Tangent = normalize(dPdt/Dv(t));

But using dPdt/Dv(t) or just dPdt seems to produce different results depending on point of view.

I.e if I rotate the camera around hairs then I get some other results for my tangents.
But hair tangent direction in world coordinates should not depend on camera position.

How can one get camera independent hair tangent?
TD @ Mr.X Inc
User Avatar
Member
1390 posts
Joined: July 2005
Offline
sergey_sh
I'm rendering hair attached to some poly surface.

Use the following to get hair tangent direction:
vector Tangent = normalize(dPdt/Dv(t));

But using dPdt/Dv(t) or just dPdt seems to produce different results depending on point of view.

I.e if I rotate the camera around hairs then I get some other results for my tangents.
But hair tangent direction in world coordinates should not depend on camera position.

How can one get camera independent hair tangent?

Isn't dPdt in camera space, which is a current space for most surface context variables?
User Avatar
Member
941 posts
Joined: July 2005
Offline
SYmek
Isn't dPdt in camera space, which is a current space for most surface context variables?

Yes. So perhaps you're looking for the *transform(to_space,vector) [sidefx.com] family of functions to transform the “current space” (which in Mantra this is the same as “camera space”) tangent vector to “world space” (which corresponds to /obj).

So, maybe something like:
vector Tangent = normalize(vtransform(“space:world”,dPdt/Dv(t));


Cheers.
Mario Marengo
Senior Developer at Folks VFX [folksvfx.com] in Toronto, Canada.
User Avatar
Member
22 posts
Joined: June 2008
Offline
Thanks SYmek, forgot about it.

vector Tangent = normalize(dPdt/Dv(t));
Tangent = vtransform(“space:world”, Tangent);

This works.

Thanks, Mario. Just saw your message after submitting mine.
TD @ Mr.X Inc
  • Quick Links