A layer of smaller surface waves added as a fractal so the user can specify the number of iterations depending on how much detail they need and how important render time is. |
|
float wave_macro = getWave(s, macro_freq, phase, macro_chop, p);
float wave_micro = getWave(s*t, macro_freq, phase, micro_chop, p);
float ripple =
getRipple(rippleFreq, rippleKm, p) ;
hump = wave_macro + wave_micro;
float i, f = rippleFreq, amp = rippleKm ;
for(i=0; i < iterations; i = i+1)
{
hump = hump + getRipple(f, amp, p);
f = f*3; amp = amp/5;
}
LIBRARY FUNCTION
float getRipple (float rippleFreq, rippleKm; point p)
{
return (noise(p*rippleFreq) - 0.5)* rippleKm;
} |