6.3 Normal

Next we come to the NORMAL_STMT. Note that light given by diffuse, highlights, reflection and refraction depends on the normal to the surface of the object. For some objects (like planes) the surface normal is explicitly given, for other it is obvious (like boxes (except at the edges), spheres, tori, etc. ). It is not for all objects an easy problem to calculate the surface normal. For an implicitly given (iso)surface $ M=f^{-1}(0)$ via a $ C^1$-function $ f$, the normal to $ M$ in a point $ x\in M$ is described by the gradient

$\displaystyle \operatorname{grad} f(x_1,x_2,x_3)
=\left\langle \frac{\d }{\d x_...
...\frac{\d }{\d x_2}f(x_1,x_2,x_3),\frac{\d }{\d x_3}f(x_1,x_2,x_3)\right\rangle
$

provided this does not vanish: In fact, the gradient of $ f$ is related to the derivative by

$\displaystyle \langle \operatorname{grad} f(x_1,x_2,x_3)\vert(v_1,v_2,v_3)\rang...
...3 v_i\cdot \frac{\d f}{\d x_i}(x_1,x_2,x_3)
=f'(x_1,x_2,x_3)\cdot(v_1,v_2,v_3)
$

That a vector $ v=(v_1,v_2,v_3)$ stands normal to the surface $ M$ at the point $ P:=(x_1,x_2,x_3)$ means that for any differentiable curve $ c$ in $ M$ with $ c(0)=P$ we have $ \langle v\vert c'(0)\rangle=0$. That $ c$ lies in $ M=f^{-1}(0)$ means that $ f\o c$ is constant and hence

$\displaystyle 0=(f\o c)'(0)=f'(c(0))\cdot c'(0)=\langle \operatorname{grad}f(c(0))\vert c'(0)\rangle,
$

by the chain-rule.

Furthermore, natural objects usually don't have mathematically perfect surfaces but irregularities like bumps, cracks or some graininess, and it would be very time-consuming to model them. Cheaper is to modify only the (virtual) normal to the object. This can be done in various ways inside the texture statement by the normal statement:

NORMAL:
  normal { [NORMAL_IDENTIFIER] [NORMAL_TYPE] [NORMAL_MODIFIER...] }

NORMAL_TYPE:
  PATTERN_TYPE [Amount] |
  bump_map { BITMAP_TYPE "bitmap.ext" [BUMP_MAP_MODS...]}

NORMAL_MODIFIER:
  PATTERN_MODIFIER | 
	NORMAL_LIST | 
  slope_map { SLOPE_MAP_BODY } | 
	normal_map { NORMAL_MAP_BODY } |
	bump_size Amount |
  no_bump_scale Bool | accuracy Float
There are four basic NORMAL_TYPEs. They are: The pattern type is optionally followed by one or more normal modifiers. Different modifiers may be used with the various NORMAL_TYPEs. In addition to general pattern modifiers such as transformations, turbulence, and warp modifiers, normals may also have a NORMAL_LIST, slope_map, normal_map, and bump_size which are specific to normals. Normal modifiers of any kind apply only to the normal and not to other parts of the texture.



Subsections
Andreas Kriegl 2003-07-23