Ashikhmin-Shirley
Required files:
rmannotes.sl
ashshirModel.h
ashshir.sl
ashshir.rib
See also: Brushed
This shader implements the Ashikmin and Shirley BRDF lighting model as
described in "An Anisotropic Phong Light Reflection Model." Most of the
work is done in ashshirModel.h by two functions - one for dealing with
direct lighting, and the other for dealing with environment lighting.
The model has some nice diffuse and specular characteristics, but I
find it very difficult to keep the specular highlights from getting out
of hand. The diffuse term of the model uses a fresnel term which causes
nice lighting in the reflected direction, and is missing from the
normal lambertian model.
An environment map or raytracing can be used to sample the environment
to get "one-bounce indirect light" (in the loosest sense). This is
importance-sampled using the method described in the same paper. The
specular and diffuse portions are sampled separately, and can give
a range of effects from blurry reflections to a radiosity-like effect.
* ---- surface parameters ----------
* rd: diffuse reflectance
* rs: specular reflectance
* nu: specular exponent along xdir
* nv: specular exponent perpendicular to xdir
* refl: amount of reflection to use
* envname: name of environment map to use. If this is "" the shader will
* try to raytrace the environment if there are samples (envsamp > 0)
* envsamp: number of samples to use when sampling the environment
Here are some images of the model, and
here is a more thorough study
of the model parameters.
|
| rd = 0.5 |
| rs = 0 |
| nu = 0 |
| nv = 0 |
| envsamp = 20 |
| refl = 0.25 |
| envname = "redblue.tdl" |
|
|
| rd = 0.5 |
| rs = 0 |
| nu = 0 |
| nv = 0 |
| envsamp = 10 |
| refl = 0.25 |
| envname = "" (raytraced) |
|
|
| rd = 0.5 |
| rs = 0 |
| nu = 0 |
| nv = 0 |
| envsamp = 20 |
| refl = 0.25 |
| envname = "redblue.tdl" |
|
|
| rd = 0.5 |
| rs = 0.5 |
| nu = 1000 |
| nv = 1000 |
| envsamp = 10 |
| refl = 1 |
| envname = "env.tdl" |
|
|
| rd = 0.5 |
| rs = 0.5 |
| nu = 1000 |
| nv = 1000 |
| envsamp = 20 |
| refl = 1 |
| envname = "" (raytraced) |
|
|
| rd = 0.5 |
| rs = 0.5 |
| nu = 1000 |
| nv = 1000 |
| envsamp = 10 |
| refl = 1 |
| envname = "env.tdl" |
|
|
| rd = 0.5 |
| rs = 0.05 |
| nu = 10 |
| nv = 1000 |
| envsamp = 10 |
| refl = 0.5 |
| envname = "env.tdl" |
|
|
| rd = 0.5 |
| rs = 0.05 |
| nu = 10 |
| nv = 1000 |
| envsamp = 10 |
| refl = 0.5 |
| envname = "" (raytraced) |
|
|
| rd = 0.5 |
| rs = 0.05 |
| nu = 10 |
| nv = 1000 |
| envsamp = 10 |
| refl = 0.5 |
| envname = "env.tdl" |
|
|
| rd = 0.1 |
| rs = 0.3 |
| nu = 10 |
| nv = 1000 |
| envsamp = 10 |
| refl = 1 |
| envname = "env.tdl" |
|
|
| rd = 0.1 |
| rs = 0.3 |
| nu = 10 |
| nv = 1000 |
| envsamp = 10 |
| refl = 1 |
| envname = "env.tdl" |
|
|
| rd = 0 |
| rs = 0.5 |
| nu = 1000 |
| nv = 10 |
| envsamp = 20 |
| refl = 1 |
| envname = "env.tdl" |
|