I had some time to give this a shot in Mantra with the ear.ptx file floating around the net. There's really nothing to it for object space maps. If I can get my hands on a tangent space map I'll get it a shot, but that should only be necessary if the object you're rendering is deforming.
VOPS
VEX
/* written by Alan Warren
* bluemoonshine@gmail.com
*
* description: shader with ptex vector displacement
*
*/
displace
aw_vdisp_example( string vdisp_map = "" )
{
vector Po = ptransform("space:current", "space:object", P);
vector Nn = normalize(N);
vector tmp;
vector result;
vector ptexcol;
vector dispP, dispN;
float uu = s;
float vv = t;
int fface = getprimid();
float duu = Du(uu);
float duv = Dv(uu);
float dvu = Du(vv);
float dvv = Dv(vv);
ptexcol = ptexture(vdisp_map, fface, uu, vv, duu, duv, dvu, dvv,
"filter", "gaussian", "lerp", 1,
"width", 1, "blur", 0);
tmp = Po + ptexcol;
result = ptransform("space:object", "space:current", tmp);
dispP = result;
//dispP += dispN;
dispN = computenormal(dispP, Nn, Ng);
P = dispP;
N = dispN;
}
Here's the
Ear PTEX Vector Map
HTH
Alan
Edited by Alanw, 01 September 2011 - 12:27 PM.