POV-Ray Fur Generator (version 2.0)
Created by Margus Ramst (margus@peak.edu.ee)
January 23, 2000

The FurGen2.zip archive should contain the following files:

fur.inc - main Fur Generator include file
admacros.inc - additional macros needed for tht Fur Generator
example.pov - example scene
readme.txt - this document


General

The Fur Generator is a set of macros for creating hair, fur, spines and
other similar features. Any POV-Ray object may be processed by the macros,
however the current official version of POV-Ray (3.1) does not have the
necessary functions to run Fur Generator. You will need a custom version
of POV that has the following features:
1) the trace() function;
2) min_extent() and max_extent() function;
Among such versions are:
POV-Ray Superpatch (http://www2.fwi.com/~parkerr/superpatch/)
POV-Ray MegaPatch (http://nathan.kopp.com/patched.htm)

The object you want to make furry is sampled and a set of points
generated over its surface. Hairs are then placed at these points.
Individual hairs are constructed of cones (one or more). Each hair
is manually bounded by a sphere to conserve memory (POV starts spitting out
warnings about this, you may turn them off with the -gw command-line switch).
Alternately, you may comment out line 416 in fur.inc to remove the
manual bounding. The scene will render slightly faster, but
memory consumption will increase.

    
Features

Fur Generator offers quite a bit of control over the appearance and
behaviour of the fur:
* Thickness of the fur (can be different along the XYZ axes)
* Length of hairs and random variation in this length;
* Number of segments making up the hair strand;
* Thickness of the strand at its base;
* Twistyness of the hairs, to give a shaggy appearance;
* Stiffness of the hairs;
* A directional force (wind, gravity, etc.) can be applied;
* Redundant hairs can be eliminated to save memory & speed up rendering;
* Generated objects or points (or both) can be exported to a file;


Hair culling

The main improvement in vesion 2 of Fur Generator is hair culling.
Hairs invisible to the camera and/or light sources are discarded,
saving memory and speeding up rendering.
The process works by eliminating points whose surface normal differs
from the viewing ray by a specified amount (controlled by the MaxAngle
parameter). Points on the surface that differ from the viewing ray by
90 degrees appear to lie on the 'horizon' of the object. Since hairs
stick out from the surface, they can be visible even when they start
below the horizon. For this reason, MaxAngle should always be greater
than 90 degrees, to avoid culling visible hairs. The longer the hairs,
the greater MaxAngle should be. Values between 95 and 110 generally
work well.
Light sources can also be tested, to avoid 'hairless' shadows.
However, the process does not work well with mirrors. Unless the
mirror is flat, it is very difficult to test which hairs it reflects.
For this reason I have decided to limit culling to cameras and
light sources. You might have to turn culling off when your scene
contains reflective objects.


File export

There are two types of file export in Fur Generator (see "fur.inc" for a
list of parameters). One writes the complete hair objects - all you
have to do later is to #include the exported file. This file parses
relatively fast and contains only those hairs that were not culled by the
sampling macro.
The problem here is inflexibility: you cannot tweak any settings.
Since culling is viewpoint-dependent, you can't use this file with
a different camera. The same goes for moving light sources.
Also, since the fur is now a single object, scaling it also scales/stretches
the individual hairs. This might not be what you want.

Hance the need for the other type of file export. This one writes
only the start points of the hairs, and the surface normals at those
points. The 'Fur_PF' macro uses this file to recreate the hairs, along
with culling.
This method is a compromise: faster than direct sampling, slower than
including a ready-made object. Fur_FP is useful in animations,
when you want to have culling, but do not wish to re-sample the object
for each frame.
Also useful when you want to rescale the fur without rescaling individual
strands - or when you want to tweak the length, thickness and bend of
the hairs without resampling.
Fur_PF can also export the complete hair objects.


Usage

Basic usage is pretty straightforward. 'Fur' requires you to specify
a predeclared object to make furry and returns a CSG union, which
in turn can be used in an object statement:

#declare Obj = any_POV_object

object{
    Fur(Obj,/other parameters/)
    /object modifiers/
}

Note that in the current example only the fur is visible.
The base object is only declared, not instanced.

'Fur_PF' works similarly, but instead of a declared object it needs
the name of the coordinate file:

object{
    Fur_PF("filename",/other parameters/)
    /object modifiers/
}

The complete hair object can be used by simply #including the file.
The object is in the form of a CSG union of cones, automatically
#declared as 'Hairs'. To use it, do the following:

#include "filename"
object{
    Hairs
    /object modifiers/
}



Please send questions and comments to
Margus Ramst (margus@peak.edu.ee)
