Fake rim-lighting with a surface shader in VEX.
A .vfl file that fakes rim-lighting.
Date Created:Friday December 29th, 2006 03:41 AM
Date Modified:Wednesday July 30th, 2008 04:17 PM
#pragma include<prman.h>
#pragma opname dan_material
#pragma oplabel "VEX DPL ParaPerp"
#pragma label dnfreq "Frequency"
//smooths edges and anti-aliasing
float pulse(float a,b,fuzz,x)
{
return(smooth(a-fuzz,a,x)-smooth(b-fuzz,b,x));
}
surface
rim(float rim_width = 0.2,
dnfreq = 1,
multdan = 1;
)
{
vector nf, n;
vector diffusecolor;
vector restpos;
float dan_noise;
//vector dan_noise;
restpos = wo_space(P)*dnfreq;
dan_noise = snoise(restpos);
n = normalize(N);
nf = faceforward(n, I);
vector i = normalize(-I);
//float dt = 1-dot(i,nf);
float dt = dot(i,nf);
Oi = smoothstep(1-rim_width, 1.0, dt)*dan_noise*multdan;
diffusecolor = 1;
Cf = Oi * Cs * diffusecolor;
}
Downloads:
Download: fakerim.vfl 793 B
Please login or Click Here to register for downloads
Fake Rim Light by Dan Lynch
is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
Based on a work at www.3daet.com
Permissions beyond the scope of this license may be available at http://www.3daet.com
