[Sidefx-houdini-list] UV Gradients

Mario Marengo mario at axyzfx.com
Fri Feb 17 22:06:05 EST 2006


Hi all,

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 
things).

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 
breath...

Any/all ideas greately appreciated.


-- 
......................................................................
Mario Marengo                                  mailto:mario at axyzfx.com
AXYZ ANIMATION                                 http://www.axyzfx.com
......................................................................



More information about the Sidefx-houdini-list mailing list