Crystal Space 2.0.0: 4.10.19.1 Furmesh Mesh Object

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

#### 4.10.19.1 Furmesh Mesh Object

Written by Alexandru - Teodor Voicu, voicualexandruteodor@gmail.com.

A Furmesh is a set of 3D triangles that is used to create both hairs and furs on base meshes (currently only AnimatedMeshes are supported). Furmeshes can update their position based on physics or on the base mesh's animation, via the Furmesh Animation Control (see section Furmesh Animation). Defining complex shaders, that can have lookup textures, updated whenever needed, is done via the Furmesh Material Properties (see section Furmesh Material). You can find some other info about the Furmesh plugin on this blog: http://hairrendering.wordpress.com/.

There is also a HOWTO discussing the creation of furmeshes. See section Creating a Furmesh Mesh.

#### Basic Structure

The following SCF class names are used (for `csLoadPlugin`):

- Type plugin: `crystalspace.mesh.furmesh`
- Loader plugin: `crystalspace.mesh.loader.furmesh`
- Factory loader plugin: `crystalspace.mesh.loader.factory.furmesh`

Objects in this plugin implement the following SCF interfaces, which you can retrieve with `scfQueryInterface`:

- MeshObject
  - Implements `‘iMeshObject’`
  - Implements `‘iFurMesh’`
- MeshObjectFactory
  - Implements `‘iMeshObjectFactory’`
  - Implements `‘iFurMeshFactory’`
- MeshObjectType
  - Implements `‘iMeshObjectType’`

#### Factory State Interface

No attributes are specified in the current factory state implementation.

#### Factory Loader

No tags supported.

#### Object State Interface

`‘iFurMeshState’` (residing in `‘CS/include/imesh/furmesh.h’`) is the SCF interface that you can use to manipulate settings for a furmesh object. By using this interface you can access the material, blending mode (mixmode), and various other configuration parameters for a furmesh object.

#### Object Loader

Here is a list of all the tags supported by a furmesh object and their meaning:

- `‘factory’` The name of the factory to use.
- `‘strandwidth’` This is a float variable used to set the width of a fur strand: `‘<strandwidth>0.001</strandwidth>’`.
- `‘displacement’` This is a float variable used to set the distance between the furmesh and the base mesh: `‘<displacement>0.02</displacement>’`.
- `‘densitymap’` This is a UV greyscale texture of the base mesh, giving information about the density of the Furmesh, based on areas. White means the highest density, while black means no furs. `‘<densitymap>krystal_skull_densitymap</densitymap>’`.
- `‘densityfactorguidefurs’` This is a float variable used to specify what is the maximum density for LOD guide furs. `‘<densityfactorguidefurs>10</densityfactorguidefurs>’`.
- `‘densityfactorfurstrands’` This is a float variable used to specify what is the maximum density for fur strands. `‘<densityfactorfurstrands>120</densityfactorfurstrands>’`.
- `‘heightmap’` This is a UV greyscale texture of the base mesh, giving information about the height of the Furmesh, based on areas. White means the biggest height, while black means 0 height. `‘<heightmap>krystal_skull_heightmap</heightmap>’`.
- `‘heightfactor’` This is a float variable used to specify what is the maximum height for furs. `‘<heightfactor>0.4</heightfactor>’`.
- `‘controlpointsdistance’` This is a float variable used to set the distance between points on a fur strand. `‘<controlpointsdistance>0.05</controlpointsdistance>’`.
- `‘positiondeviation’` This is a float variable used to set the percentage of the maximum deviation a fur strand might have. `‘<positiondeviation>0.005</positiondeviation>’`.
- `‘growtangents’` This is a variable, specifying if guide furs should initially grow based on normal or tangent direction. While normal direction is good for small furs, tangent direction might be used for longer static furs. `‘<growtangents/>’`.
- `‘mixmode’` Control the transparency of this object. See Parsing Mixmode for a list of possibilities. `‘<mixmode> <copy /> </mixmode>’`.
- `‘priority’` Set the rendering priority for this furmesh object. `‘<priority>object</priority>’`.

#### Furmesh Data Structures

Because a Furmesh can update its geometry by being synchronized with various physics objects, such as Bullet ropes for hairs (which are computationally expensive), only a small part (less than 1%) of the geometry really has such an external object attached.

This lead to creating two types of data structures: guide furs, which always have a corresponding external object and fur strands, which have references to three close guide furs in order to update their position.

Guide furs are created on each vertex of the base mesh, the mesh on which fur will grow, and are never displayed, except only for debug purpose.

Fur strands are generated by iterating through the triangles specified by the base mesh and choosing three random barycentric coordinates in order to determine their position relative to three guide furs. The barycentric coordinates are used both to update the position of fur strands, using the guide furs and to generate UV coordinates.

#### Furmesh Geometry

In order to keep the number of geometry as low as possible, fur strands are represented as triangle strips that always face the camera, not as very thin cylinders like in reality. Because of the always facing the camera constraint, all the geometry related data from the Furmesh can be computed more efficiently, directly when updating the fur strands. This is the reason why the Furmesh doesn't have any methods to compute normals, tangents or binormals, or gives access to the `iRenderBuffers`.

#### Furmesh LOD System

Due to the high number of fur strands, a LOD system had to be used, especially when the viewer was further away from the Furmesh so that it could be rendered at lower quality. Apart from displaying fewer fur strands, the number of guide furs vary as well. In order to make this possible another type of fur structure had to be added, LOD guide furs, which on lower LOD settings act as normal fur strands, while on higher LOD act as guide furs. The methods that allow setting various LODs are: `SetGuideLOD()`, `SetStrandLOD()`, or `SetLOD()` which acts as an overall LOD function, calling both previous defined methods.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

This document was generated using texi2html 1.76.