martedì 2 aprile 2013

Modelling a face

How do window makers create a face? 

When reproducing a human face in a real stained glass window, more then one method can be used:

- A single pink glass pane can be painted with grisaille to line the anathomy part, as for example the nose or the eyes.

  - The face can be subdivided in different glass panes. This method is very uncommon though, but it can be used for special artistic needs. Moreover, it can be the result of a previous restoration, if done using mending leads.

- The glass pane can be painted as a proper "stained glass". This technique gives a remarkable effect, as evident form the image at [3]. The face details (lines of the eyes, nose, mouth, traits of the hair) are painted with grisaille. In transparency, a yellow shade is visible, due to presence of silver stain, generally in the position where hair or the halo is. Grisaille is painted on the interior face of the glass, to protect the drawing from weathering. Silver stain is found on the exterior face [2].

From the modelling point of view, one of them should be chosen. But, which one? It is evident that the first method is just a simplified version of the third one, therefore there is no point to reproduce it. 

The second method can be reproduced using the methods already published in previous posts, since the mending lead is just another kind of lead came.  Again, no point.

Instead, the third method is interesting. It involves at least two different surfaces: the grisalle one and the stained one. It can be considered as an elaborated version of the first method and, of course, it was used during the Middle Ages.

To get a good idea of the thing, it is always preferable to see a glass window from very close, hopefully in situ, instead of a simple picture. Luckily the Victoria&Albert Museum in London has a big collection of stained windows, very easy to see without need for special scaffolding or binoculars, and among them this stained glass dated to 1240-1380 [4 - Museum no. Circ. 95-1930] shows exactly what I want to reproduce. 

How to model the 3D stained glass face?

Let's think to how to model the face of the figure depicted in the stained window. 

The first idea is to try to reproduce it just as it is. Therefore the glass pane, already casted in order to obtain the proper shape of the face, needs to be divided in 3 different sub-objects: 
- the interior face (with the grisaille painted on), 
- the border (not sure if the border is going to influence the final result, since it is coated by the lead cames, however, in case of a close up on the border, also this feature would need to show a proper material)
- and the exterior face (to be partially stained).
Of course, every sub-object needs to be linked to a specific material. 

Before starting...

Take care that many materials can be used for the glass, and a specific work should be done in order to find which is the combination of material/renderer that gives the most realistic results in the smallest computational time. In fact, glass material is remarkable when rendered via Mental Ray, and many glass materials are present in the library too, but they not necessarly meet the requeasts of a Middle Age glass colour and, more important - since the colour can easily modified - the time consumption to render an image can be remarkable. Moreover, according to the material/render chosen, the material rollout changes, so, even if the result to be obtained is the same, the terminology could change and  be confusing (for example, opacity/transparency/cutoff maps seem to be work the same)

However, since the Medieval glass is a soda-lime glass, with no presence of lead to increase the refractive index, indipendently by the material to be chosen, its refractive index (R. I.) should be defined between 1.45 and 1.55, according to [1].
Another general rule is that the materials are not supposed to just "wrap" the surface, but they have to simulate the "filling" of the object. It means that, for example, to allow the silver stain (that would wrap only the exterior face) to be seen in transparency from the interior face, the "2-sided" option should be thicked. If the option is not present, it is important to check that the interior part is rendered properly.

Before starting, another thing needs to be considered. If the background is black, every transparent material will appear black in the final rendering! Therefore a more realistic background should be chosen. A good choice seems to be a gradient map with three different colours, a blue one for the sky, an almost white colour for the horizon and a green one for the grass. Of course, when a proper environment and lighting will be added, the materials will be properly corrected.

Defining a material for the border (clear glass)

The border is the easiest part for applying a material on, because its material is supposed just to represent the clear glass.

However, the level of clearness should not be the one of a modern glass, almost pure in silica and therefore colourless, but that of an ancient glass, with presence of some defects that actually reduce its transparency and give a pale tint.

The tint would be almost invisible in transparency, thanks to the low thickness of the glass pane. But it would be visible  when watching at the glass pane in glazing angle (for example, when standing close to the wall of the window, looking from the very bottom of an high window) or when watching it from the edge instead of the face (possible only when the glass pane is detached from the lead, or when the leads are so bended that the window is no more plane). However, this increase in the tint should be already been calculated by the software.

The tint should be chosen between bluish/greenish/brownish (to represent the excess of iron in different oxidation states) and slightly purple (to represent an excess of manganese, used as a decolourant to contrast the colour given by iron [5]). For a general idea, some realistic tints can be inferred from reference [6] (Of course, take care to look only the bottles that were produced without adding any other colourant a part from iron/manganese!)

A starting point could be to use a olive green tint, that is very common in ancient glass (see [7]) as a test colour for the entire pane. When everything works well, the colour of the faces should be changed to an almost uncoloured tint.  

Defining the material for the interior face (grisaille)

This material should be composite of the following:
- grisaille (with a degree of transparency that allows to see the clear glass material)
- and the clear glass itself.  

Clear glass should be defined as the diffused colour, while grisaille should be represented by a map, created via a classic 2D photo editor, to be allocated in the diffused colour slot. The map should be in black and white (considering black for grisaille). Otherwise the grisaille could be coloured accordingly to its correct brownish/black colour and the glass to be left white. 

To maintain information on transparency (and avoid the glass to get a "milky" appearance, due to the presence of the pure white colour in the .jpg), the grisaille map should have, in addiction to RGB channels, an alpha channel, in which the area where the grisaille is present should be opaque, while the area of the clear glass should be transparent to allow to see through. Since .jpg doesn't support this option, only .tiff or .tga should be used for the map. 

To give a sense of roughness to the grisaille, a bump map can be applied. Unfortunately the use of a bump gives a certain 3D sense, but it also add an "ancient and weathered" appearance to the glass pane, that is pretty interesting when trying to reproduce an ancient glass, but it is not if the glass is supposed to be contemporary. Of course, it can be seen only with grazing angle, so it is pretty useless when the window needs to be seen in front. However it could be taken in consideration when modelling a weathered pane.

Another solution could be to use a displacement map for the grisaille. Displacement doesn't involve a change in the colour of the pixels, but only a motion of the points from the glass to the exterior, to simulate the light roughness of the surface. However, to get a good result, the number of polygons at the surface should be increased and therefore the general computational time could became excessive for such a small thickness (grisaille is less then 1 mm thick!).

Defining the material for the exterior face (silver stain) 

Now it all becomes easier. The silver staining, for the needs of a model, is just a different kind of grisaille, with a different colour and transparency. So everything goes the same, except to take extra care to apply correctly the diffused colour map (n.b. the exterior face of the glass pane is specular to the interior one!)

Final considerations

The glass pane should look like well now, a part from the colour of the grisaille/stain, that could be not as intense as it is supposed to be.

In fact, with this method, grisaille is applied thanks to a .tiff image with its own alpha channel dedicated to transparency. In addiction, the degree of transparency of the entire material needs to be homogeneously decreased, in order to see the pale colour of the glass! (Otherwise grisaille would be painted over a colourless pane, that is not the case I want to reproduce). So, the resulting colour of the grisaille could turn not as intense as it is supposed to be. Therefore, instead of creating a new map with a semitransparency information for the clear glass in the alpha channel (it would be too challenging to menage once applied on the object!) the output of the grisaille map can be increased in order to reproduce the requeasted dark colour. 

When using the mental ray material for glazing, the problem is easily solved because the general colour slot has a specific slider for the degree of gray in the alpha channel. It also allows to easily reproduce the frosted effect caused by surface weathering simply moving the "glossiness" slader to low value. Again, even in this case, if the grisaille fades too much, its output should be increased.

The image (fig.3) shows the final result.

stained glass pane (isolated from the rest of the window)

1. Newton R., Davison S., Conservation of Glass. 1989. Butterworth ed. 
2. Corpus Vitrearum Medii Aevi glossary -
3. Wikipedia, Silver Stain definition -
4. Victoria&Albert Museum -
5. Colours of the Medieval stained glass
6. Bottle colours -
7. Olive colour -