Water like Animated Reflection Shader
This is a simple shader which uses a noise function along with the built-in 'time' variable,to make the reflection wobble over time.In this shader the coefficient of the noise function varies on a frame to frame basis.Thus creating water like reflections.
/*source code*/
surface
wobble()
{
vector i = normalize(I);
normal n = normalize(N),
nf = faceforward(n, i);
color reflectcolor = (.5,.5,.5);
float amp = noise(u*2+.05*time);/*the time variable animates the wobble from frame to frame*/
nf=calculatenormal(P+amp*normalize(N));
Ci = Cs;
Oi = Os;
vector reflectRay = reflect(i, normalize(nf));
reflectcolor = trace(P, reflectRay);
Ci = Os * reflectcolor;
}
© 2004-6 Celambarasan Ramasamy. All rights reserved.