[Sidefx-houdini-list] UV Gradients

Mark Elendt mark at sidefx.com
Mon Feb 20 09:41:37 EST 2006

On Saturday Feb 18 at 15:13, Mario Marengo wrote:
> > Maybe you need to solve this in Sop's before the geometry goes to the
> > shader.
> > 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.
> Thanks Ben!
> Doing it in VEX-SOP-land is definitely a possibility, though it
> still requires comming up with a solid gradient calculation for
> polys (or triangular sub-polys) which, as I'm finding out is not so
> easy :P As it turns out though, I think I may be on to a solution
> (that would work in both contexts). I'll post my results in
> od[force]'s "Rendering" forum as things progress.

Attached is an example (very simple) of getting smooth tangents with a
modified aluminum shader.

The ddu VEX code is a SOP which generates smooth tangent vectors on
the geometry.  This only works for a sphere.  But hopefully, you can
figure out a way to generate smooth tangents based on texture
coordinates.  If nobody can, I'll try to generalize ddu to handle it.

The anisotropic shader (aluminum) has been modified to pick up
tangent vectors from the attributes rather than using dPds/dPdt.
There's a define at the top of the shader which turns this behaviour
on or off.  You can see the difference in the specular by toggling

There's a simple .ifd enclosed to test.  Make sure you're picking up
the correct version of the aluminum shader.

More information about the Sidefx-houdini-list mailing list