OSL
|
Introduction
This tutorial shows how
to apply interesting shading effects to different parts of a curved surface. The
technique is demonstrated by a shader called |
The shader, listing 1, also outputs a float called resultF which can be used to achieve some interesting displacement effects. |
Listing 1 - Velvet.osl
|
Using the Viewing Vector and Surface NormalThe following illustration shows how the angle between the surface normal and the line-of-sight of the camera ie. the viewing vector, changes from 0.0 degrees at the center of the object (location A) to 90.0 degrees at the rim (location B).
The angle is calculated using vector multiplication known as the dot
product (also called the scalar or inner product). The OSL function
|
© 2002- Malcolm Kesson. All rights reserved.