Moving Frostbite to Physically Based Rendering 3.0

23 篇文章 4 订阅

https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
https://www.ea.com/frostbite/news/moving-frostbite-to-pb
https://blog.csdn.net/poem_qianmo/article/details/100652463 参考毛星云的博客,非常有帮助

3.1 material models
3.1.1 appearance
surface appearance results from the interaction between incoming light and the material properties of a surface. the variety of appearances observable in the real world is quite wide, ranging from simple uniform materials to complex layered and heterogeneous 异构的 materials, see figure 4.
在这里插入图片描述
figure 4: various surface appearance showing the diversity多样性 of interaction between light and matter.

these different appearances can be categorized by certain intrinstic physical properties such as conductivity, mean-free-path, and absoption. baesd on these material properties, the literature has exposed various material models capable of representing a certain range of appearances amongst the full spectrum. material model literature is extensive, and a lot of different models exist with various trade-offs and accuracies. a material model, referred to as a BSDF (Bidirectional Scattering Distribution Function), can be decomposed into two parts: a Reflectance part (BRDF) and a Transmittance part (BTDF). in this document we will focuse on the reflective part and in particular on a material model capable of representing “standard” appearances i.e. the vase majority of surfaces we encounter in our every day life. hence, we will limit ourselves to reflective, isotropic, dielectric/conductor surfaces with short mean-free-paths.

3.1.2 Material models
in the context of this standard material model, a surface response f is often decomposed into two different terms: a low angular frequency signal called “diffuse” (fd) and a low to high angular frequency part called “specular” (fr), see figure 5.
在这里插入图片描述
figure 5: light interaction with a slab of “standard” matter. left:light interactions. right: a BSDF model of the interaction with a diffuse term fd and a specular fr.

an interface sepearates two media: the air and the matter. surfaces made of a flat interface can easily be represented by the Fresnel law [Wikd] for both dieletric and conductor surfaces. when the interface is irregular, see figure 6,
在这里插入图片描述
figure 6: shows surfaces of different roughness, modeled by D term. top: light interactions with the microfacets. middle: resulting BRDF fr lobe. bottom: resulting appearance on spheres.

the literature shows that microfacet based models[CT82] are well adapted to characterize the light interaction for these types of surfaces. a microfacet model is described by Equation 1, for more details about the derivations see [Hei14]:
在这里插入图片描述

the term D models the microfacet distribution (i.e. the NDF, normal distribution function). the G term models the occlusion (shadow-masking) of the microfacets. this formulation is valid for both the diffuse term fd and the specular term fr. the difference between these two term lies in the microfacet BRDF fm. for the specular term, fm is a perfect mirror and thus is modeled with the Fresnel F law, which leads to the well-known following formulation:
在这里插入图片描述
the term 我们把term翻译成系数的意思 D plays an important role in the appearance of surfaces, as shown by figure 6. the literature, [Wal+; Bur12] has recently pointed out that “long-tailed” NDFs, like the GGX distribution, are good at capturing real world surfaces. the G term also plays an important role for high roughness values. Heitz [Hei14] has recently shown that the Smith visibility function is the correct and exact G term to use. he also points out that the literature often tends to use an approximated version of the Smith visibility function, while a more accurate form of the masking-shadowing function models the correleation between the masking and shadowing due to the height of the microsurface, see equation 3. figure 7 shows the difference between the simple Smith function and the height-correlated Smith function.

在这里插入图片描述

For the diffuse term, fm follows a Lambertian model and Equation 1 can be simpli ed into:
在这里插入图片描述
Until recently the diffuse term fd was assumed to be a simple Lambertian model. However, except for layered materials, the diffuse part needs to be coherent with the specular term and must take into account the roughness of the surface [Bur12] (i.e specular and diffuse term should use same roughness term3), see Figure 8. The Equation 4 does not have an analytic solution. Oren et al. [ON94] found
an empirical approximation of this equation using a Gaussian NDF distribution and a V-cavity G term know as the Oren-Nayar model. To correctly support our model we should make an equivalent approximation for Equation 4 with a GGX NDF as describe in Gotanda [Got14]. Appendix B details some of our analysis about such a diffuse model, but further research is required.
在这里插入图片描述
Figure 8: Shows a view of the interaction at the micro scale for both the specular fr term, which has a mirror BRDF fm (left), and the diffuse term fd, which has a diffuse BRDF fm (right).

Burley [Bur12] has presented another diffuse model built on real world surface observations, see Equation 5. While this model is empirical, it allows us to reproduce the main features of the MERL database’s materials http://www.merl.com/brdf/. For this reason and because of its simplicity, we have chosen to use this model in Frostbite. This diffuse term takes into account the roughness of the material and creates some retro-reflection at grazing angles.
在这里插入图片描述

3.1.3 energy conservation
energy conservation is important to consider in order to not add more energy than received. in addition it allows us to correctly handle the behavior at grazing angles, for which the light tends to be scattered more by the specular term than the diffuse term. in frostbite 寒霜引擎 we have chosen to keep the computation simple and only ensure the preservation of energy, by ensuring that the hemispherical directional reflectance, which gives the total reflecance in a given direction due to constant illumination over the hemisphere, is below for our whole BRDF (diffuse+specular term):

在这里插入图片描述
3.1.5 frostbite standard model
to summarize, frostbite’s “standard” material model is close to the one used by other game engines [Kar13;NP13;Bur12]. it is composed of:

  1. specular term fr: a specular microfacet model (see equation 2) with a smith coorelated visibility function and a GGX NDF.
  2. diffuse term fd: the Disney diffuse term with energy renormalization.

for both parts, we apply our dominant direction correction (off-specular peak handling) when integrating lighting. the parameters for manipulating these models will be described in the next section.

forstbite also supports other types of material such as clear coat 漆 and materials with subsurface scattering, but we will focus only on the standard material model in this document.
插入一条消息:菲涅尔近似公式,F0就是当入射角为0的时候,其反射系数。详细可参考:https://blog.csdn.net/wodownload2/article/details/100096281
在这里插入图片描述
D_GGX——法线分布函数是:https://blog.csdn.net/wodownload2/article/details/100096281
在这里插入图片描述

float3 F_Schlick (in float3 f0 , in float f90 , in float u)
{
	return f0 + (f90 - f0) * pow (1. f - u, 5.f);
}

float V_SmithGGXCorrelated ( float NdotL , float NdotV , float alphaG )
{
	// Original formulation of G_SmithGGX Correlated
	// lambda_v = (-1 + sqrt ( alphaG2 * (1 - NdotL2 ) / NdotL2 + 1)) * 0.5 f;
	// lambda_l = (-1 + sqrt ( alphaG2 * (1 - NdotV2 ) / NdotV2 + 1)) * 0.5 f;
	// G_SmithGGXCorrelated = 1 / (1 + lambda_v + lambda_l );
	// V_SmithGGXCorrelated = G_SmithGGXCorrelated / (4.0 f * NdotL * NdotV );
	
	// This is the optimize version
	float alphaG2 = alphaG * alphaG ;
	// Caution : the " NdotL *" and " NdotV *" are explicitely inversed , this is not a mistake .
	float Lambda_GGXV = NdotL * sqrt ((- NdotV * alphaG2 + NdotV ) * NdotV + alphaG2 );
	float Lambda_GGXL = NdotV * sqrt ((- NdotL * alphaG2 + NdotL ) * NdotL + alphaG2 );
	
	return 0.5 f / ( Lambda_GGXV + Lambda_GGXL );
 }

 float D_GGX ( float NdotH , float m)
 {
	 // Divide by PI is apply later
	 float m2 = m * m;
	 float f = ( NdotH * m2 - NdotH ) * NdotH + 1;
	 return m2 / (f * f);
 }

 // This code is an example of call of previous functions
 float NdotV = abs( dot (N, V)) + 1e -5f; // avoid artifact
 float3 H = normalize (V + L);
 float LdotH = saturate ( dot (L, H));
 float NdotH = saturate ( dot (N, H));
 float NdotL = saturate ( dot (N, L));

 // Specular BRDF
 float3 F = F_Schlick (f0 , f90 , LdotH );
 float Vis = V_SmithGGXCorrelated (NdotV , NdotL , roughness );
 float D = D_GGX (NdotH , roughness );
 float Fr = D * F * Vis / PI;

 // Diffuse BRDF
 float Fd = Fr_DisneyDiffuse (NdotV , NdotL , LdotH , linearRoughness ) / PI;

Listing 2: BSDF evaluation code.

关于Vis系数的来历,在函数V_SmithGGXCorrelated 中的注释部分已经给出了,考虑到fr的公式,分母除以了4倍的pi,还有ndol,ndov,那么,和公式:
在这里插入图片描述
在这里插入图片描述
那么将这部分:
在这里插入图片描述
那么,则会得到上面的V_SmithGGXCorrelated 中的方法体了。
而且在毛星云的博客中:https://blog.csdn.net/poem_qianmo/article/details/100652463
提到:Frostbite的Lagarde[Lagarde 2014 ]观察到对GGX高度相关的Smith G2(height-correlated Smith G2)具有与镜面微平面BRDF的分母组合时抵消的项, 因此可以简化组合项为:
在这里插入图片描述
在这里插入图片描述
所以你会发现:
在这里插入图片描述
fr的计算,就只除以了pi,原因就是上面已经将分母的4NdotLNdotV,考虑过了。

3.2 material system

3.2.1 material

frostbite is used in a wide variety of games, from sports to racing, from first person shooters to open world games. in order to satisfy the different requriements that these games have, the engine needs to offer flexible controls regarding lighting and material support. in addition, one of the constraints during the move to PBR was to ensure compatibility with our old non-PBR lighting model in order to ease the transition. the lighting path is controllable, supporting: deferred, forward, or hybrid. this path will be detailed in section 4.11.

In Frostbite a “material” is defined by:
1) A lighting path: deferred, forward or both.
A set of input parameters: diuse, smoothness, thickness, etc.
A material model: rough surface, translucency, skin, hair, etc., as well as non-PBR rough
surface. This is the shader code.
A GBuffer layout in case of deferred path support. The number of buffers is variable.

a game team can choose a set of materials from those available for a given light path. each material is identified with a materialD attribute for the game. a base material covering the most common cases (which we call the “standard material”) is always present and defines parameters shared with other material (e.g. roughness). for deferred shading the base material is commonly set to the “Disney” model, referring to Burley’s model [Bur12]. however, we also support two other base material: a “two-color” material and an “old” material.

Disney base material: our disney material uses the following parameters:
normal: standard normals
basecolor: defines the diffuse albedo for non-metallic objects and Fresnel reflectance at normal incidence (f0) for metallic ones, as suggested by Burley’s presentation. for metallic objects the lower part of this attribute defines a micro-specular occlusion.

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值