Chapter 14. Advanced Techniques for Realistic Real-Time Skin Rendering

https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch14.html

the shading performance of modern GPUs, coupled with advances in 3D scanning technology, research in rendering of subsurface scattering effects, and a detailed understanding of the physical composition of skin, has made it possible to generate incredibly realistic real-time images of human skin and faces. figure 14-1 shows one example. in this chapter, we present advanced techniques for generating such images. our goal throughout is to employ the most physically accurate models available that exhibit a tractable real-time implementation. such physically based models provide flexibility by supporting realistic rendering across different lighting scenarios and requiring the least amount of tweaking to get results.
在这里插入图片描述
Figure 14-1 Real-Time Rendering of Realistic Human Skin

14.1 The Appearance of Skin

Skin has always been difficult to render: it has many subtle visual characteristics, and human viewers are acutely sensitive to the appearance of skin in general and faces in particular. The sheer amount of detail in human skin presents one barrier. A realistic model of skin must include wrinkles, pores, freckles, hair follicles, scars, and so on. Fortunately, modern 3D scanning technology allows us to capture even this extreme level of detail. However, naively rendering the resulting model gives an unrealistic, hard, dry-looking appearance, as you can see in Figure 14-2a. What’s missing? The difficulties arise mainly due to subsurface scattering, the process whereby light goes beneath the skin surface, scatters and gets partially absorbed, and then exits somewhere else. Skin is in fact slightly translucent; this subtle but crucial effect gives skin its soft appearance and is absolutely vital for realistic rendering, as shown in Figure 14-2b.
在这里插入图片描述
Figure 14-2 Comparison of Skin Rendering

For most materials, the reflectance of light is usually separated into two components that are handled independently: (1) surface reflectance, typically approximated with a simple specular calculation; and (2) subsurface scattering, typically approximated with a simple diffuse calculation. However, both of these components require more advanced models to generate realistic imagery for skin. Even the highly detailed diffuse, specular, and normal maps available with modern scanning techniques will not make skin look real without accurate specular reflection and subsurface scattering.

14.1.1 skin surface reflectance
a small fraction of the light incident on a skin surface (roughly 6 percent over the entire spectrum (Tuchin 2000)) reflects directly, without being colored. this is due to a Fresnel interaction with the topmost layer of the skin, which is rough and oily, and we can model it using a specular reflection function. we illustrate this process in Figure 14-3 in relation to a multilayer skin model that works well for skin rendering (Donner and Jensen 2006). the light reflects directly off of the oily layer and the epidermis without entering and without being scattered or colored. the reflection is not a perfect mirror-like reflection because the surface of skin has a fine-scale roughness, causing a single incident angle to reflect into a range of exitant 居然找不到这个单词的意思 angles. we can describe the effect of this roughness with a specular bidirectional reflectance distribution function, or BRDF.

在这里插入图片描述
Figure 14-3 A Multilayer Skin Model

simple empirical specular calculations, such as the familiar Blinn-Phong model long supported by opengl and direct3D, do not accurately approximate the specular reflectance of skin. physically based specular models provide more accurate-looking results, leading to more realistic images. in section 14.3, we explore one such model (used to compute all the images shown in this chapter) and show how to implement it efficiently on the gpu.
14.1.2 Skin Subsurface Reflectance

any light not directly reflected at the skin surface enters the subsurface layers. the scattering and absorption of light in substance tissue layers give skin its color and soft appearance. Light enters these layers, where it is partially absorbed (acquiring color) and scattered often, returning and exiting the surface in a 3D neighborhood surrounding the point of entry. Sometimes light travels completely through thin regions such as ears. A realistic skin shader must model this scattering process; Figure 14-2a appears hard and dry precisely because this process is ignored and because light can reflect only from the location where it first touches the surface.

Complicating the process further, multiple layers within the skin actually absorb and scatter light differently, as shown in Figure 14-4. Graphics researchers have produced very detailed models that describe optical scattering in skin using as many as five separate layers (Krishnaswamy and Baranoski 2004). Real skin is even more complex; medically, the epidermis alone is considered to contain five distinct layers (Poirer 2004). Simulating scattering at this complexity is probably excessive, but realistic rendering requires modeling at least two distinct layers below the oily layer responsible for specular reflection. Donner and Jensen 2005 demonstrate that a single-layer model is insufficient and show the improvement obtained from using a three-layer model. We show a similar comparison in Figure 14-11, in Section 14.4.3, using our real-time system, which is capable of modeling this multilayer scattering. Donner and Jensen 2006 later introduce a two-layer model that still gives convincing results.
在这里插入图片描述

Figure 14-4 Scattering and Absorption in Multiple Tissue Layers
https://blog.csdn.net/poem_qianmo/article/details/81866093
经验表面,皮肤渲染的可分为两个分量:
1、镜面反射(specular reflection)
2、次表面散射(subsurface scattering)

镜面反射:相对简单,Gem3中推荐Kelemen and Szirmay-Kalos specular BRDF 用于皮肤镜面反射项的计算。因为Kelemen and Szirmay-Kalos specular BRDF的实现和Torrance-Sparrow 模型一样的渲染效果时,计算量要小得多。而现阶段基于物理的一些其他高光模型或改进方案应该会得到不错的结果。

次表面散射:
1、半透明材质与表面散射

To simulate this process for the purpose of image synthesis, researchers have borrowed (and improved upon) scattering models from the physics community. A certain class of scattering models has proven very successful for skin rendering. Beneath the skin surface, the incoming light quickly becomes diffuse as it scatters: photons scatter often in the tissue layers, and after only a few scattering events, even a completely coherent beam of light will be flowing equally in all directions. This simplifies the general scattering problem greatly, leading to what are called diffusion models. However, diffusion models remain mathematically sophisticated and the literature can be challenging to read. In Section 14.5, we discuss shading operations, many as simple as blurring an image, that serve to accurately and efficiently simulate the core effects of these models, allowing easy-to-program GPU algorithms that produce realistic, real-time images.

14.2 An Overview of the Skin-Rendering System
The following sections present the details of our real-time skin-rendering system, which is the sum of a specular reflection component and a subsurface scattering component. The GPU implementation of both components is described in detail, including a review of diffuse scattering theory and presentation of a new formulation for scattering profiles.

Section 14.3 addresses the topmost interaction of light and skin, specular surface reflectance, and discusses an efficient implementation of the Kelemen and Szirmay-Kalos 2001 analytic BRDF. This model closely approximates the Torrance/Sparrow model, which has been shown to produce realistic images of faces (Donner and Jensen 2005, Donner and Jensen 2006, Weyrich et al. 2006) but is significantly cheaper to evaluate and gives much of the same appearance. Measured parameters from Weyrich et al. 2006 work well for tuning both models for rendering faces.

In Section 14.4 we review existing scattering theory, with a focus on diffusion profiles, how they are used to render images with subsurface scattering, and in particular how their exact shape is important for producing a realistic skin appearance. We present a new sum-of-Gaussians formulation of diffusion profiles that has many advantages, including new rendering algorithms presented in Section 14.5. The new formulation can closely approximate the popular dipole (Jensen et al. 2001) and multipole (Donner and Jensen 2005) analytic diffusion profiles, and we discuss how to accurately fit Gaussian sums to known profiles (with a brief error analysis). The sum-of-Gaussians profiles for the three-layer skin model used to render all images in this chapter are given as a starting point for the reader.

In Section 14.5, we begin by modifying texture-space diffusion (Borshukov and Lewis 2003) to take advantage of the sum-of-Gaussians diffusion profiles by convolving irradiance separably and hierarchically, similar to Green 2004. However, a series of intermediate Gaussian convolution textures are retained and combined in the final render pass to quickly and accurately approximate the scattering predicted by a multilayered model. Distortions that arise when convolving in texture space are corrected similar to Gosselin 2004 by using a stretch texture that locally corrects convolution kernels. However, our stretch-correction texture corrects for distortions in both the U and V directions independently and is quickly computed using a simple fragment shader (allowing considerable deformations of the mesh and eliminating the need for precomputation and artist input).

Transmission through thin surface regions such as ears is accomplished by modifying translucent shadow maps (Dachsbacher and Stamminger 2004) to compute depth through the surface and to connect shadowed regions to locations on the light-facing surface, where multiple convolutions of irradiance are available by accessing the same textures computed for local scattering. The separability of Gaussians in the third dimension is exploited to reuse 2D convolutions of irradiance when computing the desired 3D convolution.

Finally, in Section 14.6, the same separable and hierarchical techniques used to accelerate subsurface scattering are used to accelerate 2D convolution with a wide, nonseparable bloom filter by approximating it as a sum of two Gaussians.

14.3 Specular Surface Reflectance
The Phong specular model is almost ubiquitous 无处不在的 in real-time computer graphics, but using a more accurate physically based surface reflectance model can easily improve image quality at a cost of a few extra shader instructions. The Phong model fails to capture increased specularity at grazing angles and is not physically plausible (it can output more energy than it receives, for example). Figure 14-5 demonstrates the limitations of the Phong model compared to a physically based specular BRDF.
在这里插入图片描述
Figure 14-5 Comparing the Kelemen/Szirmay-Kalos Specular BRDF to the Phong Model

This section discusses the implementation of physically based specular BRDFs in general, as well as specific details pertaining to skin rendering. We present an efficient implementation of the Kelemen/Szirmay-Kalos model and discuss all of the model parameters and how they are adjusted for rendering skin.

14.3.1 Implementing a Physically Based Specular Reflectance Model for Skin
Many physically based specular BRDFs from computer graphics literature can be used to improve the realism of skin rendering. We first discuss implementation details common to all BRDF models and then give the specifics of the Kelemen/Szirmay-Kalos model that we chose for its efficient evaluation.

Rendering with a BRDF
Most specular BRDF models describe reflectance with analytic functions that are straight-forward to evaluate in a fragment shader. Such models are typically the product of several terms, such as Fresnel and geometric attenuation terms, and have several parameters.

specularLight += lightColor[i] * lightShadow[i] * rho_s *
	specBRDF( N, V, L[i], eta, m) * saturate( dot( N, L[i] ) );

Because of the definition of a BRDF, the dot(N, L[i]) term is required in addition to computing the BRDF itself. A distance attenuation term may also be added per light to reduce intensity as a function of the distance to the light source. This code works for point, directional, or spotlights, for which an L vector and a shadow term can be computed. Specular reflections from rough surfaces due to environment map light sources or area lights—called glossy reflections—are complicated and computationally quite costly and we do not incorporate them into our skin rendering system. The interested reader should see Kautz and McCool 2000 for a real-time technique that uses prefiltered environment maps.
Fresnel Reflectance for Rendering Skin
All physically based specular BRDF models contain a Fresnel term, which is typically not explained in detail. This should be an unpolarized, dielectric Fresnel reflectance function with an F 0 (or R 0) parameter (reflectance at normal incidence) of 0.028. This comes from Beer’s Law and assumes an index of refraction for skin of 1.4 (Donner and Jensen 2006). Pharr and Humphreys 2004 provide an excellent presentation of Fresnel reflectance and Beer’s Law, and we will not repeat the formulae here. When computing a Fresnel term for a rough surface like skin, all terms should be measured from the half-angle vector, H, and not from N. Schlick’s Fresnel approximation (Schlick 1993) works well for skin, as shown in Figure 14-6. Listing 14-1 gives the function for computing the Schlick Fresnel reflectance.

Figure 14-6 Comparing Fresnel Formulations When Computing Kelemen/Szirmay-Kalos Specular Reflectance

Example 14-1. A Function for Computing the Fresnel Reflectance in Specular BRDFs
H is the standard half-angle vector. F0 is reflectance at normal incidence (for skin use 0.028).

float fresnelReflectance( float3 H, float3 V, float F0 )
{
	float base = 1.0 - dot( V, H );
	float exponential = pow( base, 5.0 );
	return exponential + F0 * ( 1.0 - exponential );
}

Factoring BRDFs for Efficient Evaluation

Factoring BRDFs for Efficient Evaluation
Heidrich and Seidel 1999 describe a precomputation strategy useful for efficiently evaluating BRDF models, based on factoring the BRDF into multiple precomputed 2D textures. We employ a similar approach to efficiently compute the Kelemen/Szirmay-Kalos specular BRDF, but instead we precompute a single texture (the Beckmann distribution function) and use the Schlick Fresnel approximation for a fairly efficient specular reflectance calculation that allows m, the roughness parameter, to vary over the object.

We first render a screen-aligned quad with the fragment shader shown in Listing 14-2, which precomputes the Beckmann distribution texture. Figure 14-7c shows the resulting texture. This step can be done once when the application starts or simply saved to a texture file for later use. We use an exponential scale and halve the resulting value to map the function into a range we can store in an 8-bit texture and then we invert this mapping during the specular computation. (Alternatively, we could use a floating-point texture to reduce computation at the cost of texture bandwidth.) Listing 14-3 gives the final specular function used to render with the precomputed texture. Figure 14-7 compares the full specular computation to the fast version for a range of roughness values. Only the specular reflection is shown. It is difficult to distinguish the approximation from the full BRDF evaluation.
在这里插入图片描述

Figure 14-7 Comparing Direct Computation of the Specular Model to the Fast Version

Example 14-2. Code to Precompute the Beckmann Texture

 float PHBeckmann( float ndoth, float m )
{
  float alpha = acos( ndoth );
  float ta = tan( alpha );
  float val = 1.0/(m*m*pow(ndoth,4.0))*exp(-(ta*ta)/(m*m));
  return val;
}
// Render a screen-aligned quad to precompute a 512x512 texture.
   float KSTextureCompute(float2 tex : TEXCOORD0)
{
  // Scale the value to fit within [0,1] – invert upon lookup.
   return 0.5 * pow( PHBeckmann( tex.x, tex.y ), 0.1 );
}

Example 14-3. Computing Kelemen/Szirmay-Kalos Specular Using a Precomputed Beckmann Texture

float KS_Skin_Specular( float3 N, // Bumped surface normal
   float3 L, // Points to light
   float3 V, // Points to eye
   float m,  // Roughness
   float rho_s, // Specular brightness
   uniform texobj2D beckmannTex )
{
	float result = 0.0;
	float ndotl = dot( N, L );
	if( ndotl > 0.0 )
	{
		 float3 h = L + V; // Unnormalized half-way vector
		 float3 H = normalize( h );
		 float ndoth = dot( N, H );
		 float PH = pow( 2.0*f1tex2D(beckmannTex,float2(ndoth,m)), 10.0 );
		 float F = fresnelReflectance( H, V, 0.028 );
		 float frSpec = max( PH * F / dot( h, h ), 0 );
		 result = ndotl * rho_s * frSpec; // BRDF * dot(N,L) * rho_s
	}
	return result;
}

specular reflectance from skin is white
the tissue cells and oil in the outermost layer of skin are dielectric materials that reflect light without coloring it (whereas metals such as gold color the light that is reflected due to highly varying indices of refraction over visible wavelengths of light). thus, a physically based skin shader should use a white specular color. in other words, the specular reflection of a white light from skin will be white, and the specular reflection of a colored light will be the same color as that light——regardless of the color of the underlying skin. a common problem encountered when rendering skin without proper gamma correction (see Chapter 24 of this book, “The Importance of Being Linear”) is an overly yellow color when adding white specular reflectance to the diffuse subsurface scattering term. If all rendering is done in a linear color space and displayed correctly, the specular color should not need to be adjusted to something other than white.

Varying specular parameters over the face
a survey of human faces presented by Weyrich et al. 2006 provides measured parameters for the Torrance/Sparrow specular BRDF model with the Beckmann microfacet distribution function. They assume such a model is valid for skin surface reflectance and measure roughness m and intensity rho_s for ten regions of the face across 149 faces. The results, available in their SIGGRAPH 2006 paper, provide a great starting point for tuning a specular BRDF for rendering faces. The Torrance/Sparrow model is approximated closely by the Kelemen/Szirmay-Kalos model, and the measured parameters work well for either. Their data can be easily painted onto a face using a low-resolution two-channel map that specifies m and rho_s for each facial region. Figure 14-8 compares rendering with the measured values of Weyrich et al. versus constant values for m and rho_s over the entire face. The difference is subtle but apparent, adding some nice variation (for example, by making the lips and nose shinier).
在这里插入图片描述

Figure 14-8 Comparing Constant Values for and to Using Measured Values

Using a clever application of light polarization 极化, Ma et al. 2007 rapidly 快速的 capture reflectance from faces, which they separate into specular and diffuse components. This is used to produce high-resolution normal, color, and specular intensity (rho_s) maps, as well as high-resolution geometry of the face. The resulting data yields realistic renderings (see d’Eon et al. 2007), and the specular map provides specular variation at a much higher resolution than the Weyrich et al. parameters (but assumes a fixed roughness).

14.4 scattering theory
we now turn from specular surface reflectance to diffuse subsurface scattering. before tackling 解决 realistic skin-rendering algorithms, we must first introduce the concept of a diffuse profile 漫反射理论. this key concept from subsurface scattering theory, derived from a failry complex mathematical analysis of the physics of propagation and scattering of light in translucent materials, is nonetheless intuitive and easy to explain.

We should note that the techniques described in this chapter apply only to diffusion models. In particular, we do not handle single scattering effects, where each light ray scatters beneath the surface exactly once. Ignoring single scattering when rendering skin generally proves acceptable (however, see Section 14.7.1), but for some materials (such as marble, jade, and smoke), single scattering will significantly impact appearance. Realistic rendering of these materials must incorporate single scattering, with methods that to date are far more expensive or restrictive than the techniques we present (Jensen et al. 2001, Wang et al. 2005). Fortunately, a diffusion approximation alone works very well for skin.

14.4.1 Diffusion Profiles
A diffusion profile provides an approximation for the manner in which light scatters underneath the surface of a highly scattering translucent material. Specifically, it describes the outcome of the following simple experiment (which is sometimes used to measure diffusion profiles). Consider a flat surface in a dark room with a very thin, white laser beam illuminating it. We will see a glow around the center point where the laser beam is striking the surface, because some light is going beneath the surface and returning nearby, as shown in Figure 14-9a. The diffusion profile tells us how much light emerges as a function of the angle and distance from the laser center. If we consider only uniform materials, the scattering is the same in all directions and the angle is irrelevant. Each color has its own profile 侧面、外形、轮廓的意思,这里理解为轮廓, which we can plot 绘图 as a 1D curve, 这里可以绘制成1D的曲线,如图14-9b图所示 as illustrated in Figure 14-9b. [1]
在这里插入图片描述
Figure 14-9 Visualizing a Diffusion Profile 可视化扩散剖面
Diffusion:n. 扩散,传播;[光] 漫射

Notice that the profiles are strongly color dependent 和颜色相关的: red light scatters much farther than green and blue. The absorption properties of skin are very sensitive to changes in frequency; in fact, researchers have implemented spectral models that simulate scattering in 150 color bands separately (Donner and Jensen 2006), and thus compute 150 diffusion profiles! Though we could in principle implement a similar spectral model on the GPU, the resulting improvement probably would not justify 证明合法 the many extra render passes and textures required. 虽然我们原则上可以在GPU上实现一个类似的光谱模型,但由此带来的改进可能并不足以证明需要许多额外的渲染通道和纹理。 All images in this chapter were rendered using RGB light transport. 本章中的所有图像都是使用RGB光传输渲染的。

14.4.2 rendering with diffusion profiles
given the appropriate diffusion profiles, simulating subsurface scattering within skin reduces to the proess of collecting all incoming light for each location on the surface and then spreading it around into neighboring locations based on the exact shapes of the profiles. 有了适当的扩散剖面,模拟皮肤内部的散射简化为收集表面上每个位置的所有入射光,然后根据剖面的精确形状将其散步到邻近位置的过程。we can think of each tiny region on a surface as simulating the laser dot experiment shown in figure 14-9a. a very narrow patch of incoming light creates a larger, colored patch of outgoing light. every region on the surface needs to do this and all the overlapping, colored patches sum to give a translucent appearance.

because incoming light becomes diffuse so quickly in skin, we can sum all incident light at each point on the surface and ignore its direction, except for an N.L term for each light and optional Fresnel transmittance terms we discuss later (in section 14.5.2). the directionally of incoming light is lost almost immediately, so only the total number of light is important. this diffuse light then scatters into neighboring regions (the exact amount is determined by the diffusion profiles) and is assumed to exit the surface flowing equally in all directions (again, for maximum realism a Fresnel transmittance term is required as the diffuse light exists the surface). this allows fairly simple rendering algorithms, which we present shortly. but first we need to know the exact diffusion profiles that describe scattering in skin.

the widely used scattering model of Jensen et al. 2001 introduces an analytic formula for diffuse profiles based on several material properties. given these properties, the profiles are computed using a dipole equation 偶极子方程. a later paper (Donner and Jensen 2005) introduces a multipole theory for handling multilayered materials. they also present a three-layer skin model and we use the profiles predicted by this model for our skin rendering system.

along with the dipole model, jensen et al. 2001 also presents an efficient technique for rendering curved surfaces using diffusion profiles. the idea is to simply use the spatial separation 空间划分, r, between two points on the surface to evaluate the diffusion profiles. this determines diffuse scattering between any two locations, regardless of the geometry between them, as shown in figure 14-10. although not physically accurate, the typical curvatures encountered in skin surfaces are fairly low compared to the effective radius of scattering, and the approximation works well in practice. 虽然在物理上并不精确,但与有效的散射半径相比,在皮肤表面遇到的典型曲率是相当低的,而且这种近似在实践中很有效。
在这里插入图片描述
Figure 14-10 An Efficient Estimation of Diffuse Scattering in Curved Surfaces

14.4.3 the shape of diffusion profiles
accurate rendering requires knowing the exact shapes of the diffusion profiles for the materal we want to simulate, which the dipole (Jensen et al. 2001) or multipole (Donner and Jenen 2005) diffusion models compute based on measured scattering parameters. the simpler dipole model suffices for many materials. to render milk, marble or ketchup 番茄酱, we can look up measured scattering coefficients and use a dipole to compute diffusion profiles for them.

however, for materials composed of several layers, each with different scattering properties, the shapes of the profiles become more complicated than a dipole can represent. using the more complicated multipole model can significantly improve the visual appearance of multilayered material such as skin. figure 14-11 compares skin renderings with single-layer versus three layer subsurface scattering. note that the specular light, the normals, and the diffuse color are exactly the same in each rendering. the key difference is in the shape of the diffusion profiles used. the simple shape of the dipole, derived for scattering in a single, infinitely thick layer, leads to a waxy look. the dipole can not capture combined reflectance of a thin, narrowly scattering epidermis layer on top of a widely scattering dermins layer.
在这里插入图片描述
Figure 14-11 The Exact Shape of Diffusion Profiles Matters

14.4.4 A Sum-of-Gaussians Diffusion Profile
the profiles plotted in figure 14-9b resemble the well-known Gaussian function 在这里插入图片描述.
although a single Gaussian does not accurately fit any diffusion profile, we have found that multiple Gaussians summed together can provide an excellent approximation. this proves enormously useful in practice. Gaussians have some nice properties that let us evaluate subsurface scattering very efficiently when we express diffusion profiles as sums of Gaussians. Gaussians are unique in that they are simultaneously separable and radially symmetric 高斯函数的独特之处在于它们同时是可分离的和径向对称的, and they convolve with each other to produce new Gaussians.

the rendering techniques presented in this chapter use a sum-of-Gaussians formulation. this requries a mapping from a dipole or multipole-based profile to a Gaussian sum. for each diffusion profile R®, we find k Gaussians with weights wi and variances 方差 vi such that
在这里插入图片描述
where we choose the following definition for the Gaussian of variance v:
在这里插入图片描述
The constant 1/(2v) is chosen such that G(v, r), when used for a radial 2D blur, does not darken or brighten the input image (it has unit impulse response). 常数1/(2v)的选择使得G(v, r)用于径向二维模糊时不会使输入图像变暗或变亮(它具有单位脉冲响应)。

figure 14-12 shows a diffusion profile (for the scattering of green light in marble) and approximations of the profile using two and four Gaussian sums. We use the scattering parameters from Jensen et al. 2001:
在这里插入图片描述
Figure 14-12 Approximating Dipole Profiles with Sums of Gaussians

The four-Gaussian sum is R® = 0.070G(0.036, r) + 0.18G(0.14, r) + 0.21G(0.91, r) + 0.29G(7.0, r).
Rendering with the true dipole versus the four-Gaussian sum (using an octree 八叉树 structure following Jensen and Buhler 2002 to ensure accuracy) produces indistinguishable results.
https://www.cnblogs.com/psklf/p/9526690.html
散射是皮肤渲染当中最重要的概念,也是皮肤这个材质,与其他的区别最大的一点。皮肤有很多层,光线在某个点入射后,一部分光被反射,另一部分光线被折射进入皮肤内部,在皮肤内部(特别是内部的不同的层次之前),光会被吸收,会发生散射现象,最后,在入射点附近的一个3D点上终止(能量耗尽)或者射出表面。如果需要渲染逼真的皮肤表面,必须对此现象进行仿真。研究者假设光线进入皮肤后迅速向四周散射,在很少的几次散射后,光线就已经变成各个方向平行地蔓延了。这样简化以后就提出了一个叫做diffuse models的模型。

再此基础上再次简化,研究者提出 diffusion profile 这个概念。这代表的是在一个表面上有一个光的发射点,有光在这个点向四周扩散,那么与这个点有不同距离的任意点,有多少光线到达了这个点,或者说分配到了多少的光的能量? diffusion profile 描述的就是光线传播的关系,给定一个距离可以得出该点的光的强度。这个函数是和 RGB 颜色的光有关的,红色的光有最强的扩散能力,能比另两种颜色的光传播更远的距离。根据这个概念,我们考虑皮肤的次表面散射的计算,在入射点射入的光线,向四周传播,其衰减的规律符合 diffusion profile. 那么在皮肤表面任意一点的话,需要考虑每一个入射点的次表面散射对该点的影响,将所有的结果累加就是最终的散射效果。因为皮肤下的散射现象发生得非常的迅速,所以我们几乎可以不考虑入射光线的方向,那么散射的计算就只需要考虑距离这一个因素就可以了。

那么究竟这个 profile 是怎样的呢?研究者发现可以用若干个不同系数的高斯函数来拟合这个函数。如下图我们可以看到,四个高斯函数和的拟合效果已经很接近原始函数了。这四个高斯函数的计算是这样的,如上面所示。

14.4.5 fitting predicted or measured profiles
this section discusses techniques for approximating a known diffusion profile with a sum of Gaussians. this is not essential to implementing the rendering techniques presented later on, but this section may be useful to readers wishing to accruately approximate subsurface scattering for a material for which they have measured scattering coefficients. other readers will simply wish to implement the skin shader and interactively experiment with a small number of intuitive parameters (the individual Gaussian weights) to explore the softness of the material, instead of using the parameters computed from scattering theory. we also provide the exact Gaussians used to render all images in this chapter, which should provide a good starting point for rendering Caucasian 高加索人 skin.

the dipole and multipole functions mentioned already can be used to compute diffusion profiles for any material with known scattering coefficients. alternatively, diffusion profiles can be measured from a real-world object by analyzing scattering of laser or structured light patterns (Jensen et al. 2001, Tariq et al. 2006). once we know exact profiles for the desired material, we must find several Gaussians whose sum matches these profiles closely. we can find these by discretizing 分离 the known profile and then using optimization tools (such as those available in Matehmatica and MATLAB) that perform the fitting for us. these fitting functions are based on minimizing an error term. if we know a target diffusion profile R® with which we want to render, we find k Gaussians that minimize the following:
在这里插入图片描述
this computes an error function, where a squared error between R® and the sum of Gaussians at radial distance 径向距离 r is weighted by r, because the profile at position r gathers light from a circle with circumstance proportional to r. both wi and vi for each Gaussian are allowed to vary.

for Gaussians are sufficient to model most single-layer materials. as an experiment, we have fit four Gaussians to every material profile listed in Jensen et al. 2001, which gives measured parameters for many materials such as milk, marble, ketchup, skin and more. for each material, we measured error with the following metric
在这里插入图片描述
which gives a root-mean-square ratio between the error in fitting R® with a sum of Gaussians, Gsum ®, and the target profile itself. The errors ranged from 1.52 percent (for Spectralon, blue wavelength) to 0.0323 percent (for ketchup, green wavelength). Of course, additional Gaussians can be used for increased accuracy and for approximating multilayer materials, which have more complex profiles.

14.4.6 plotting diffusion profile
plotting the 1D radial profile and the Gaussian sum that approximates it can help visualize the quality of the fit. we recommend a radially-weighted visualization that plots r x R® 乘法运算 versus distance, r, as shown previously in figure 14-12; this weights the importance of a value at radius r based on the circle proportional to radius r to which it is applied during rendering. this has the nice property that the area under the curve is proportional to the toal diffuse response (the color reflected when unit white light reflects off the surface). if the fit is poor for r in the range [r1, r2]

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值