Search - User list
Full Version: Daft shader question
Root » Technical Discussion » Daft shader question
Henster
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
Mario Marengo
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);
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB