|
/* Shader description goes here */
displacement
CLdisplace_test(float Km = 0.1,
numwaves = 0,
numwaves2 = 0,
offset = 0,
offset2 = 0,
height1 = 0,
height2 = 0,
noiseP1 = 0,
noiseP2 = 0,
noiseP3 = 0,
noisePow1 = 0,
noisePow2 = 0,
noisePow3 = 0,
noisePow4 = 0,
noiseP4 =0;
string spacename = "world",
crtwave= "object";
output varying float caps = 1,
hump3 = 1)
{
/* STEP 1 - make a copy of the surface normal one unit in length */
normal n = normalize(N);
/* STEP 2 - calculate an appropriate value for the displacement */
float s_shift = s + offset;
float s_shift2 = s + offset2;
// Add some interesting random features
//s_shift = s_shift + noise(t * 5, 3 * s) * 0.1;
// Parent the noise to a different coordinate system
point pp = transform(spacename, P);
point p2 = transform (crtwave, pp);
float OVnoise = noise(pp * noiseP3)* noisePow3;
float OVnoise1 = noise(p2 * noiseP4) * noisePow4;
float hump = 0;
float hump2= 0;
//float hump3 = 0;
s_shift = s_shift + noise(pp * noiseP1)* noisePow1 ;
s_shift2 = s_shift2 + noise(p2 * noiseP2 )* noisePow2 ;
hump = sin(s_shift * 2 * PI * numwaves)* height1;
caps= abs(sin(s_shift2 * 2 * PI * numwaves2)* height2);
float brkshape1 = caps + OVnoise;
hump3 =hump + brkshape1 + OVnoise + OVnoise1;
//hump2 = sin( hump 0.1 * 2 * PI * numwaves2);
/* STEP 3 - calculate the new position of the surface point */
/* "P" based on the value of hump */
P = P - n * hump3 * 0.5 * Km;
/* STEP 4 - calculate the new orientation of the surface normal */
N = calculatenormal(P);
}
|