ARDirectionalLightEstimate

Estimated environmental lighting information associated with a captured video frame in a face-tracking AR session.

估计的环境照明信息与脸部追踪AR Session中捕获的视频帧相关联。


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.)

概述

当您将lightEstimationEnabled属性设置为YES时,运行人脸跟踪ARSession(请参阅ARFaceTrackingConfiguration)时,ARKit会使用检测到的人脸作为光线探测器来估计场景中的定向照明环境。 Session给出的每个帧的lightEstimate属性包含一个包含此信息的ARDirectionalLightEstimate实例。

如果您为AR场景渲染自己的叠加图形,则可以在着色算法中使用此信息,以帮助使这些图形与相机捕捉的场景的真实照明条件相匹配。 (ARSCNView类自动使用此信息配置SceneKit照明。)


                    Examining Light Parameters


sphericalHarmonicsCoefficients
Data describing the estimated lighting environment in all directions.
描述所有方向的估计照明环境的数据。

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.

讨论

球面谐波为空间点周围的全球照明环境提供了一个紧凑的数学模型,描述了多个定向光源的分布和颜色。 在支持基于环境照明的渲染器中使用时,球面谐波比立方体贴图纹理提供更少的高频细节,但可以更高效地使用GPU资源。

ARKit在分开的红色,绿色和蓝色数据平面中提供二级球面谐波。 因此,该数据缓冲区包含3组9个系数,或总共27个32位浮点类型的值。

primaryLightDirection
A vector indicating the orientation of the strongest directional light source in the scene.
指示场景中最强定向光源的方向的矢量。

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.

讨论

当ARKit分析检测面部的定向照明环境时,所得到的照明估计可以表示具有不同方向和强度的多个光源的影响。 要访问此级别的细节以用于自定义渲染代码,请使用sphericalHarmonicsCoefficients属性。

如果您的应用使用不支持基于环境照明的技术显示AR内容,则此primaryLightDirection属性表示场景中定向光源的平均值。 这个向量被标准化并且在世界坐标空间中。

primaryLightIntensity
The estimated intensity, in lumens, of the strongest directional light source in the scene.
估计的强度,流明中场景中最强的定向光源。

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.)

讨论

当ARKit分析检测面部的定向照明环境时,所得到的照明估计可以表示具有不同方向和强度的多个光源的影响。要访问此级别的细节以用于自定义渲染代码,请使用sphericalHarmonicsCoefficients属性。

如果您的应用使用不支持基于环境照明的技术显示AR内容,则此primaryLightIntensity属性表示场景中定向光源的平均值。该值被缩放为适合用于渲染使用逼真照明度量的体系结构,值为1000表示中性照明。

例如,您可以直接将此值传递给SceneKit方向灯的强度属性,以获得与设备相机捕捉的真实世界场景大致相同的照明效果。 (但是,将此值传递给SceneKit通常不是必需的; ARSCNView类会根据sphericalHarmonicsCoefficients属性自动设置SceneKit光照。)


Inherits From  ARLightEstimate

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 159,117评论 4 362
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 67,328评论 1 293
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 108,839评论 0 243
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 44,007评论 0 206
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,384评论 3 287
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,629评论 1 219
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,880评论 2 313
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,593评论 0 198
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,313评论 1 243
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,575评论 2 246
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 32,066评论 1 260
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,392评论 2 253
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 33,052评论 3 236
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,082评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,844评论 0 195
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,662评论 2 274
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,575评论 2 270

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,106评论 0 10
  • 保护自己版权,嗯… 版权归作者所有,任何形式转载请联系作者。 作者:七彩小苹果(来自豆瓣) 来源:https://...
    七彩小苹果阅读 90评论 0 0
  • 这些天满心思都在和偷鸡的野兽斗智斗勇,差点错过了这越来越浓的春意。田野中、山坡上,到处都长出了可爱的新叶。...
    学士鸡地阅读 166评论 0 0
  • Do you want to marry me?Yes, I do.Do you want to listen t...
    李之琴阅读 285评论 0 3
  • 傍晚,国外时差七小时的老马忽然微信说,每一个今天,都是我们余生里最年轻的一天,好忧伤。 这句话一年前我在朋友圈发过...
    听说_阅读 198评论 0 0