[Sidefx-houdini-list] UV Gradients
Ben.Schrijvers at framestore-cfc.com
Sat Feb 18 08:13:44 EST 2006
Maybe you need to solve this in Sop's before the geometry goes to the
That means calculating the local X and Y vector for each point in VEX.
The vectors should interpolate the same as UV so no penalty's for doing
it in Sop's
I've got the feeling you can use the neighbour VEX functions for this so
you have to build a VEX Sop node.
I don't know exaclty how but it means looping though all neighbours and
using U to weight each P to get a vector in V.
Then a bit of normalization and maybe a cross product here and there to
get a nice (90 degree angle) coordinate system.
Can you see where I'm going? I know you can! But else let me know..
Mario Marengo wrote:
>I just can't seem to figure this one out... :(
>Part of my shader requires that I build a local coordinate system (seems to be
>the theme of the month, lol) at P that is oriented such that its X-axis lines
>up with the projected *texture* coordinate system's U-axis, and the local
>Y-axis with the texture's V-axis. Finally, the local Z axis can be left
>matching the shading normal. Texture uv coordinates are bound to the object
>as the vector parameter "uv".
>For any parametric surface, I can calculate the uv gradient like this:
>vector dpdu = Du(P);
>vector dpdv = Dv(P);
>vector local_x = normalize(Du(uv.x)*dpdu + Dv(uv.x)*dpdv);
>vector local_y = normalize(Du(uv.y)*dpdu + Dv(uv.y)*dpdv);
>vector local_z = normalize(frontface(N,I));
>But my object is polygonal (remodeling is not an option) and the above breaks
>down for any poly which is not perfectly rectangular -- try it on a triangle
>grid as an extreme example to see what I mean.
>The problem is not that the orientation of dPds and dPdt is flip-flopping all
>over the place, but that they are not orthogonal to each other... and I
>haven't been able to compensate for that fact (after trying a *lot* of
>So I'm stuck.
>I'm going to try and sample a uv-ramp at three points and see if I can get the
>gradient like I would for a density function, but I'm not holding my
>Any/all ideas greately appreciated.
More information about the Sidefx-houdini-list