XRSession: thuộc tính preferredReflectionFormat

Khả dụng hạn chế

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

Thuộc tính chỉ đọc preferredReflectionFormat của giao diện XRSession trả về định dạng phản chiếu ưa thích của phiên này được sử dụng cho dữ liệu texture ước tính ánh sáng.

Giá trị

Một chuỗi biểu diễn định dạng phản chiếu. Các giá trị có thể:

XRReflectionFormat WebGL Format WebGL Internal Format WebGPU Format HDR
"srgba8" RGBA SRGB8_ALPHA8 "rgba8unorm-srgb"
"rgba16f" RGBA RGBA16F "rgba16float"

Ví dụ

Yêu cầu một light probe với định dạng ưa thích của hệ thống

Bạn có thể yêu cầu một light probe bằng XRSession.requestLightProbe() và chỉ định định dạng ưa thích của hệ thống bằng cách đặt tùy chọn reflectionFormat bằng XRSession.preferredReflectionFormat.

js
const lightProbe = await xrSession.requestLightProbe({
  reflectionFormat: xrSession.preferredReflectionFormat,
});

Thông số kỹ thuật

Thông số kỹ thuật
WebXR Lighting Estimation API Level 1
# dom-xrsession-preferredreflectionformat

Tương thích trình duyệt

Xem thêm