Daft shader question

   3311   1   0
User Avatar
Member
196 posts
Joined: July 2005
Offline
Sorry to be asking this one. I've got that problem of applying a shader to a plane but rotated the wrong way and ends up all streched over the surface.

Its a rman shader if that makes any difference. Heres the code:

surface xxx (float d=0.5; float freq=10)
{
float bw=noise(s*freq,t*freq);
normal Nf=faceforward(normalize(N),I);

color Ct=mix(color “rgb”(bw,bw,bw),Cs,d);

Oi=Os;
Ci=Oi*Ct*diffuse(Nf);
}

Cheers Henster
Henster
User Avatar
Member
941 posts
Joined: July 2005
Offline
Any rotation, stretching, or distortion of any kind, has nothing to do with your shader (which simply assume that s and t are well defined) and everything to do with how you are applying your texture coordinates.
Make sure your geometry gets a properly defined MAPU and MAPV, and your noise will work fine.

BTW; you don't need to specify “rgb” when declaring a color since that is the default color space; so that line could be just:
color Ct=mix(color(bw),Cs,d);
Mario Marengo
Senior Developer at Folks VFX [folksvfx.com] in Toronto, Canada.
  • Quick Links