# A Practical Microcylinder Appearance Model for Cloth Rendering to Implementation (1)

This article is a day 22 part of raytracing advent calendar 2018

Sorry for late!

日本語でも良い方はこちらを ( If you like Japanese, please check this )

## Cloth and Fiber

There are several categories fibers used in cloth. For example, animal, plant and synthetic. Let's check.

### animal

Name | Based on |
---|---|

Wool | Fur of sheep |

Cashmere | Fur of cashmere goat |

Silk | Silkworm cocoon |

Mohair | Angora goat |

### plant

Name | Based on |
---|---|

Cotton | Cotton plants of the genus Gossypium in the mallow family Malvaceae |

Linen | Linum |

Ramie | Boehmeria nivea |

### synthetic

Name | Based on |
---|---|

Polyester | Petroleum etc. |

Nylon | Coal or petroleum |

Each of these fibers is a one-dimensional structure. Clothes need to make two-dimensional plane by some structure. For example, Felt is a sheet of entangled wool. We classify such cloth as ** nonwoven fabric (Nonwoven fabric) **.

※ Nonwoven fabric（zoom）不織布 - Wikipedia より

In contrast, a cloth by wave orthogonal thread, it is named "woven cloth".

※ Silk Crepe de Chine (zoom) IMAN SADEGHI, OLEG BISKER, JOACHIM DE DEKEN, HENRIK WANN JENSEN, UC San Diego, "Practical Microcylinder Appearance Model for Cloth Rendering"

Other than these, "knitting" is that created by make looping structure and connect vertically and horizontally with curved thread.

※ 信州大学繊維学部, はじめて学ぶ繊維 P.140

We use knitting cloth for T-shirt, socks and Sportswear because of elasticity from this structure.

※ 信州大学繊維学部, はじめて学ぶ繊維 P.140

## Cloth shading model

Many people have researched cloth shading, for a long time. The old one is Michael Ashikhmin, Simon Premoze, Peter Shirley, "A microfacet-based brdf generator" , mention to microfacet based Satin, Velvet shading model. Irawan, Marschner proposed massive woven cloth BRDF(Piti Irawan, "Appearance of Woven Cloth"). This support large-scale and small-scale analytic shading model. It is implemented to Mitsuba render But...it is too difficult for me...

These models are a surface-based approach. But there are some volumetric approaches. Wenzel Jakob, Adam Arbree, Jonathan T. Moon, Kavita Bala, Steve Marschner, "radiative transfer framework for rendering, materials with anisotropic structure" , Its scarf image is amazing.

※ Figure 1 (a) Isotropic scattering. Wenzel Jakob, Adam Arbree, Jonathan T. Moon, Kavita Bala, Steve Marschner, "radiative transfer framework for rendering, materials with anisotropic structure"

There are many interesting papers, but I have chosen woven cloth shading model described at IMAN SADEGHI, OLEG BISKER, JOACHIM DE DEKEN, HENRIK WANN JENSEN, UC San Diego, "Practical Microcylinder Appearance Model for Cloth Rendering" . This model support only large-scale appearance, the appearance of individual threads is ignored. But it can reproduce cloth anisotropic behavior and It is a good match to measured cloth BRDF. Additionary, the rendered image is very impressive, in particular, Silk Shot Fabric.

This characteristic gradation is caused by weft and warp threads that have each different color.

## A Practical Microcylinder Appearance Model for Cloth Rendering

This approach in this paper has the following flow.

- BSDF measurement for individual threads.
- Create a shading model for individual threads.
- Create a BRDF model by two orthogonal threads.
- Tuning the visibility and shading from a woven pattern and tangent distribution.
- Apply Shadowing and Masking, and tuning shading weight from its tangent ( in this paper, called "Reweighting").

## Coordinate System

Let's check the coordinate system at Fig. 9 in the paper.

- is an angle from the normal plane of thread t.
- is an angle from cloth normal in thread normal plane.

But is not used for indivisual thread bsdf model. Instead of this,

An amount such as above is used for thread bsdf.
Let's check the significance of each angle.

is a difference angle between incident angle and outgoing angle .

is a middle angle between incident angle and outgoing angle . As this is closer to 0, the specular reflection component becomes stronger.

is half angle from difference angle between incident angle and outgoing angle . In other words, it is angle between and .

※ is half angle but is not half. This cause little bit confusing. But I use the same definition according to this paper. Incidentally, Iman Sadeghi's Ph.D. Thesis "Controlling the Appearance of Specular Microstructures" use no half angle at "5.2 Background Theory".

## Thread model

We will describe a thread bsdf model by using above the angle definition. A thread is assumed that it is a rough dielectric cylinder, it is defined by the following two functions.

Where is specular component on cylinder surface, is volumetric scattering component in cylinder. What is the denominator ? So I will think about this.

### denominator

If cylinder surface is perfectly smooth, incident light is reflected angle. The fact is already mentioned at もふもふレンダリング（３） . But I visualize this behavior following.

So, we can define a scattering function by using δ function.

Where is density function,

Additionally, I'll check the energy conservation.

The term is works well. It is essential term for discribe something. The angle θ can be anything angle, but is this scattering invariant? I'll check two extreme cases.

First, case.

Second, case.

First case rays is higher density than second case rays. As is closer to , becomes bigger and bigger, so term expresses this change of density.

### Extending from δ function

Stephen R. Marschner, Henrik Wann Jensen, Mike Cammarano, "Light Scattering from Human Hair Fibers" extend the above scattering models to a rough surface.

is no longer true. It use instead of this, but it is approximate. So thread bsdf model in the paper contains term because of this.

## Specular component

Specular component is defined following equation.

Where is fresnel term and is normalized gaussian function (average is zero). I'll discuss the fresnel term later, is

is a middle angle between incident angle and outgoing angle . So as close to 0, the specular component is more stronger. Also we can modify the lobe shape by changing the variance.

※I ignore fresnel term in this plot.

### What is ?

has a characteristic shape. This is

※ desmos : cos(theta/2)

This is based on a considering of distribution rays reflection from a smooth cylinder. I'll show this visualization by raytracing.

It shows that the reflected rays have a high density as incident angle close to an outgoing angle. Conversely, as an incident angle far from an outgoing angle, the reflected rays have low density. I will think about this property.

In this picture, we can see the relationship between and the point P.

Where a incident ray is reflected to as a outgoing ray.

So,

Using this fact, we get the following relationship and .

The derivative is

Where is smallness x per smallness reflected angle. It shows how distrebutions the smallness x belonging to unit length (=1) has. So, in the above section "Extending from δ function" , N can be

And, the integration in a around must be 1 because of N is density function.

We can use the following derivative

So,

We have verified. So specular component equation

come from here.

### Missing

But, there is no in this equation! Actually, In Eugene d’Eon, Guillaume Francois, Martin Hill, Joe Letteri, Jean-Marie Aubry, "An Energy-Conserving Hair Reflectance Model"

When,

Then,

Figure 3 shows how amount this expression value, as several , as changing .

I have plotted graph to verify by using this implementation.

It shows

※ unit is degrees, the horizontal unit is an outgoing angle (unit: radians), the vertical unit is outgoing radiance.

※ Total reflectance from cylinders - Google スプレッドシート

This is exactly same to Eugene d’Eon, Guillaume Francois, Martin Hill, Joe Letteri, Jean-Marie Aubry, "An Energy-Conserving Hair Reflectance Model" Figure 3. So the energy amplifies in the most part of this. This fact causes a motivation to introduce energy conservation Mp function from spherical gaussian.

From this, specular component has potential amplify the energy 4 times from above expression. But, it is not a mistake. IMAN SADEGHI, OLEG BISKER, JOACHIM DE DEKEN, HENRIK WANN JENSEN, UC San Diego, "Practical Microcylinder Appearance Model for Cloth Rendering" has no energy conservation description. It is not the focal point in this paper. So I'll finish this study, go next.

### Fresnel Term

Fresnel term is defined by

Sorry...I can't find where is come from. But and is both angle from half angle. And a product of these terms means that the angle is treated as grazing angle if either one of the cosine of them approaches 0. In this paper says "We considered using the full microfacet specular formulation, but found that it did not improve the matching to our measured results".

I choose the following fresnel expression as fresnel term from Bruce Walter, Stephen R. Marschner, Hongsong Li, Kenneth E. Torrance, "Microfacet Models for Refraction through Rough Surfaces". It describes as "A convenient exact formulation for dielectrics with unpolarized light".

## Volume scattering component

is defined by

Where A is a spectrum dependence absorption coefficient. The coefficient that the specular component doesn't contain makes outgoing light colored.

### F Term

F is defined by following expression in this paper.

But I don't find more details in the paper, but maybe

and,

is undefined in the paper. However, If cylinder volume multiple scattering is assumed that is described by the term,

is not so bad, I think. but I choose the following expression for my implementation.

### Term

effect is exactly same to specular component without the variance parameter. So it is modeled that refracted rays has same behavior with reflected rays on cylinder surface (= these has same ). Is it ture ? Let's check this by tracking refracted rays into a smooth dielectric cylinder. ( Houdini vex: tracking refraction · GitHub )

Where the incident rays has = 45° . And plotting its shows

Surprisingly, all of the outgoing vectors is exactly the same angle to its incident angle. It has the same behavior even if use other incident angles. This fact is already showed at Stephen R. Marschner, Henrik Wann Jensen, Mike Cammarano, "Light Scattering from Human Hair Fibers" , section "A Loci of reflections". This is the figure 16. In the explanation of "A Loci of reflections", this is explained by treating the normal of the dielectric cylinder as the normal of the equator of the sphere.

※ The part with n, n 'is the cylinder normal.

where on sphere is seen incident vector. And this incident vector can intersect with various normals on the equator (only front-side, ). First, I'll talk about typical normal directly under .

The refract to with a relative refractive index with surface normal . With snell's law,

where , we get

What is ? Geometrically, we can treat that it is in the figure respectively. So we get

But normal is not only on the figure but also it can be any vector on the equator of the sphere. Let's check the following figure for other cases .

※ I add that of .

where a amount of projected to Y axis is

I consider what value it will be. First, with Snell's law,

So,

Next,

Because of the above equation, we get

Then, vector direction is exactly inverse of direction . So,

Using this, we get

Oh, I remember .

It says that ** a vertical distance of refracted vector from equator plane depend on only refractive index ** for any . In addition, considering that it goes out after entering from the dielectric cylinder, the refractive indices cancel each other out, and when exiting it exits at the same θ as incident θ (although it will reverse about positive and negative).

Because of this, term in volume scattering component is plausible. Although it is modeled with a rough dielectric cylinder, it seems that the light that enters inside will repeat scattering inside it. So, g in the volume scattering component has a different variance parameter from the specular component. And all of is greater than on Table Ⅱin this paper.

### Denominator

In this paper says "The division by the sum of projected cosines comes from Chandrasekhar [1960], in his derivation for diffuse reflectance due to multiple scattering in a semi-infinite medium." I'm afraid I can't understand these details because of my limited knowledge. But the paper says that this term has an effect to match more to brdf measurements.

※ Chandrasekhar [1960] = Subrahmanyan Chandrasekhar, "Radiative Transfer"

### term

term simply express isotropic scattering for cotton, linen, and so on. It interpolate to .

I'll show specular component lobe. It's intuitive I think.

I have completed introducing modeling of an individual thread. Next I will describe the shading model by using this.