Main Content


Calculate specular reflectance


R = specular(Nx,Ny,Nz,S,V)


R = specular(Nx,Ny,Nz,S,V) returns the reflectance of a surface with normal vector components [Nx,Ny,Nz]. S and V specify the direction to the light source and to the viewer, respectively. You can specify these directions as three vectors [x,y,z] or two vectors [Theta Phi] (in spherical coordinates).

The specular highlight is strongest when the normal vector is in the direction of (S+V)/2 where S is the source direction, and V is the view direction.

The surface spread exponent can be specified by including a sixth argument as in specular(Nx,Ny,Nz,S,V,spread).