XRLightEstimate: sphericalHarmonicsCoefficients 屬性
XRLightEstimate 介面的只讀 sphericalHarmonicsCoefficients 屬性返回一個 Float32Array,其中包含 9 個球面諧波係數。
球面諧波照明是一種使用球面函式而不是標準照明方程的技術。有關更多資訊,請參閱 Wikipedia。
值
一個包含 9 個球面諧波係數的 Float32Array。該陣列總共有 27 個元素,每 3 個元素定義一個係數的紅色、綠色和藍色分量。
前 3 個元素必須是有效的照明估計分量;其餘元素可能由於隱私設定或裝置提供更多資料的限制而為 0。
示例
在 XRFrame 迴圈中,您可以使用 sphericalHarmonicsCoefficients 屬性來照亮場景。
js
const lightProbe = await xrSession.requestLightProbe();
// frame loop
function onXRFrame(time, xrFrame) {
let lightEstimate = xrFrame.getLightEstimate(lightProbe);
// Render lights using lightEstimate.sphericalHarmonicsCoefficients
}
規範
| 規範 |
|---|
| WebXR 光照估算 API Level 1 # dom-xrlightestimate-sphericalharmonicscoefficients |
瀏覽器相容性
載入中…