I'm trying to distort s and t coordinates with turbulence. Here is my shader:
surface textureStandard
(
float layers = 4;
float startingFreq = 4;
float gain = 1;
float lacunarity = 1.9132;
string noiseSpace = "shader";
float Ka = 1;
float Kd = 0.5;
float Ks = 0.5;
float roughness = 0.1;
color specularcolor = 1;
)
{
/*Initialisation*/
normal Nf = faceforward (normalize(N),I);
vector V = -normalize(I);
color Ct;
float i;
float mag = 0;
float freq = 1;
point PP = transform(noiseSpace, P);
PP *= startingFreq;
/*Texturing*/
for (i = 0; i < layers; i += 1)
{
mag += abs(float noise(PP * freq) - 0.5) * 2/pow(freq * gain);
freq *= lacunarity;
}
float ss = mag + 0.5;
float tt = mag + 0.5;
Ct = color texture("texture.tx", ss, tt);
/*Shading*/
Oi = Os;
Ci = Oi * ( Ct * (Ka * ambient() + Kd * diffuse(Nf)) +
specularcolor * Ks * specular(Nf,V,0.1));
}
For some reason, I keep getting these error messages:
ERROR: Arguments to function no valid : operator+ - 28
ERROR: Shader not compiled.
I'm not sure what the problem is.