Estimated environmental lighting information associated with a captured video frame in a face-tracking AR session.
估計的環(huán)境照明信息與臉部追蹤AR Session中捕獲的視頻幀相關(guān)聯(lián)蝌戒。
Overview
When you run a face tracking AR session (see?ARFaceTrackingConfiguration) with the?lightEstimationEnabled?property set to?YES, ARKit uses the detected face as a light probe to estimate the directional lighting environment in the scene. The?lightEstimateproperty of each frame vended by the session contains an?ARDirectionalLightEstimateinstance containing this information.
If you render your own overlay graphics for the AR scene, you can use this information in shading algorithms to help make those graphics match the real-world lighting conditions of the scene captured by the camera. (The?ARSCNView?class automatically uses this information to configure SceneKit lighting.)
概述
當(dāng)您將lightEstimationEnabled屬性設(shè)置為YES時串塑,運(yùn)行人臉跟蹤ARSession(請參閱ARFaceTrackingConfiguration)時,ARKit會使用檢測到的人臉作為光線探測器來估計場景中的定向照明環(huán)境北苟。 Session給出的每個幀的lightEstimate屬性包含一個包含此信息的ARDirectionalLightEstimate實例桩匪。
如果您為AR場景渲染自己的疊加圖形,則可以在著色算法中使用此信息友鼻,以幫助使這些圖形與相機(jī)捕捉的場景的真實照明條件相匹配傻昙。 (ARSCNView類自動使用此信息配置SceneKit照明。)
? ? ? ? ? ? ? ? ? ? Examining Light Parameters
sphericalHarmonicsCoefficients
Data describing the estimated lighting environment in all directions.
描述所有方向的估計照明環(huán)境的數(shù)據(jù)彩扔。
Discussion
Spherical harmonics provide a compact mathematical model for the global lighting environment around a point in space, describing the distribution and colors of multiple directional light sources. When used in a renderer that supports environment-based lighting, spherical harmonics provide much less high-frequency detail than a cube map texture, but make much more efficient use of GPU resources.
ARKit provides second-level spherical harmonics in separate red, green, and blue data planes. Thus, this data buffer contains 3 sets of 9 coefficients, or a total of 27 values of 32-bit floating point type.
討論
球面諧波為空間點周圍的全球照明環(huán)境提供了一個緊湊的數(shù)學(xué)模型妆档,描述了多個定向光源的分布和顏色。 在支持基于環(huán)境照明的渲染器中使用時虫碉,球面諧波比立方體貼圖紋理提供更少的高頻細(xì)節(jié)贾惦,但可以更高效地使用GPU資源。
ARKit在分開的紅色敦捧,綠色和藍(lán)色數(shù)據(jù)平面中提供二級球面諧波须板。 因此,該數(shù)據(jù)緩沖區(qū)包含3組9個系數(shù)兢卵,或總共27個32位浮點類型的值习瑰。
primaryLightDirection
A vector indicating the orientation of the strongest directional light source in the scene.
指示場景中最強(qiáng)定向光源的方向的矢量。
Discussion
When ARKit analyzes the directional lighting environment for a detected face, the resulting lighting estimate can represent the influence of multiple light sources with different directions and intensities. To access this level of detail for use in your custom rendering code, use the?sphericalHarmonicsCoefficients?property.?
If your app displays AR content using a technology that doesn’t support environment-based lighting, this?primaryLightDirection?property represents the average of directional light sources in the scene. This vector is normalized and in world coordinate space.
討論
當(dāng)ARKit分析檢測面部的定向照明環(huán)境時秽荤,所得到的照明估計可以表示具有不同方向和強(qiáng)度的多個光源的影響杰刽。 要訪問此級別的細(xì)節(jié)以用于自定義渲染代碼,請使用sphericalHarmonicsCoefficients屬性王滤。
如果您的應(yīng)用使用不支持基于環(huán)境照明的技術(shù)顯示AR內(nèi)容贺嫂,則此primaryLightDirection屬性表示場景中定向光源的平均值。 這個向量被標(biāo)準(zhǔn)化并且在世界坐標(biāo)空間中雁乡。
primaryLightIntensity
The estimated intensity, in lumens, of the strongest directional light source in the scene.
估計的強(qiáng)度第喳,流明中場景中最強(qiáng)的定向光源。
Discussion
When ARKit analyzes the directional lighting environment for a detected face, the resulting lighting estimate can represent the influence of multiple light sources with different directions and intensities. To access this level of detail for use in your custom rendering code, use the?sphericalHarmonicsCoefficients?property.?
If your app displays AR content using a technology that doesn’t support environment-based lighting, this?primaryLightIntensity?property represents the average of directional light sources in the scene. This value is scaled to be appropriate for use in rendering architectures that use realistic lighting metrics, with a value of 1000 representing neutral lighting.
For example, you can pass this value directly to the?intensity?property of a SceneKit directional light for lighting results that roughly match those of the real-world scene captured by the device camera. (However, passing this value to SceneKit is generally not necessary; the?ARSCNView?class automatically sets SceneKit lighting based on the?sphericalHarmonicsCoefficients?property.)
討論
當(dāng)ARKit分析檢測面部的定向照明環(huán)境時踱稍,所得到的照明估計可以表示具有不同方向和強(qiáng)度的多個光源的影響曲饱。要訪問此級別的細(xì)節(jié)以用于自定義渲染代碼,請使用sphericalHarmonicsCoefficients屬性珠月。
如果您的應(yīng)用使用不支持基于環(huán)境照明的技術(shù)顯示AR內(nèi)容扩淀,則此primaryLightIntensity屬性表示場景中定向光源的平均值。該值被縮放為適合用于渲染使用逼真照明度量的體系結(jié)構(gòu)啤挎,值為1000表示中性照明驻谆。
例如,您可以直接將此值傳遞給SceneKit方向燈的強(qiáng)度屬性,以獲得與設(shè)備相機(jī)捕捉的真實世界場景大致相同的照明效果胜臊。 (但是勺卢,將此值傳遞給SceneKit通常不是必需的; ARSCNView類會根據(jù)sphericalHarmonicsCoefficients屬性自動設(shè)置SceneKit光照。)
Inherits From ?ARLightEstimate