Sunday, August 18, 2013

Reflection SLBOX cheat

Synopsis

Some problems came up with the reflection node in SLIM, the shading normal connection wasn't doing anything and I needed to modify it for some watery reflection, so had to roll my own in a SLBOX.

SLBOX code
normal Nf = faceforward (N, I);
vector V = -normalize (I);

point p = transform("object", P);
normal n = transform("object", N + point "object" (0,0,0));
p += normalize(n) * b * amplitude;
p = transform("object", "current", p);
n = calculatenormal(p);

vector D = reflect(normalize(I), normalize(n));
D = vtransform("current", "world", D);

result = Kr * color environment(v8, D) * v9 * v10;
 


  1. float b is a fractal noise used to modify the normal. 
  2. color v8 is an environment texture, remember to convert using environment setting. 
  3. color v9 and v10 are just some more noise and/or fresnel functions.

0 comments:

Post a Comment