trouble with displacement shader



hi guys,i've just started with renderman.
im using 3Delight renderer & advanced renderman for reference.
i tried writing a displacement shader that displaces a surface based on
the float value looked up from a texture file(conc.tdl).it should just
emboss the texture on the surface isnt it?,but when i apply this shader
the objects appear to crack and disintegrate?!!
why is this happening?what could be wrong?

any help would be greatly appreciated,thx.

heres the code for the displacement shader
----------------------------------------------------
displacement texturedisplace(float Km = 0.7;
string texname = "conc.tdl")
{
float hump = 0;
normal n = normalize(N);

/* set the displacement to the grayscale
value of the texture map */
if(texname != "")
hump = float texture(texname);

P = P + n * hump * Km;
N = calculatenormal(P);
}
---

.



Relevant Pages