WebXR 總覽WebXR Overview

JavaScript 開發JavaScript development

JavaScript 是世界上最受歡迎的程式設計語言之一!JavaScript is one of the most popular programming languages in the world! 它在網路上很簡單、輕量且廣泛使用。It's simple, lightweight, and widely used on the web. 利用 JavaScript 和 web 技能的強大功能,創造更吸引人的混合現實體驗。Leverage the power of your JavaScript and web skills to create more engaging Mixed Reality experiences.

Web 上的混合現實應用程式Mixed Reality applications on the web

混合的現實功能可透過使用 WebXR在網站上取得。Mixed Reality features are available on the web by the use of WebXR. 您可以在不安裝任何其他軟體或外掛程式的情況下,于相容 WebXR 的瀏覽器中看到虛擬實境 (VR) 和增強的現實 (AR) 內容。You can see virtual reality (VR) and augmented reality (AR) content in a compatible WebXR-enabled browser without installing any additional software or plugins. 您可以使用相同的瀏覽器與實體裝置(例如 HoloLens 2)。You can use that same browser with a physical device like the HoloLens 2.

WebXR 裝置 API適用于存取 虛擬實境 (VR) 和增強的 現實 (AR) 裝置,包括 感應器網路 上的 前端裝載顯示器The WebXR Device API is for accessing virtual reality (VR) and augmented reality (AR) devices, including sensors and head-mounted displays on the Web. WebXR 裝置 API 目前適用于 Microsoft Edge,且 Chrome 79 版和更新版本支援以 WebXR 作為預設值。WebXR device API is currently available on Microsoft Edge and Chrome version 79 and later versions supports WebXR as a default. 您可以在 caniuse.com上檢查 WebXR 的最新瀏覽器支援狀態。You can check the latest browser support status for WebXR at caniuse.com.

注意

WebVR 已被取代,無法在目前的瀏覽器中使用,因此不應該用於任何新的開發。WebVR is deprecated and is not available in current browsers, hence it should not be used for any new development. 您必須將任何現有的 WebVR 執行移至 WebXRYou will need to migrate any existing WebVR implementations forward to WebXR.

觀看 WebXRViewing WebXR

您可以在 Windows Mixed Reality 上查看 WebXR experinces, 以及新的 Microsoft EdgeFirefox 事實You can view WebXR experinces on Windows Mixed Reality and the new Microsoft Edge and Firefox Reality. 若要測試您的瀏覽器是否支援 WebXR,您可以在瀏覽器中流覽至WebXR 範例To test if your browser supports WebXR, you can navigate to WebXR Samples in your browser

我可以使用哪些功能來開發沉浸式 web 體驗?What can I use to develop immersive web experiences?

下列清單顯示的 JavaScript 架構和 Api,可用於建立目前市場上的沉浸式體驗,並受到混合現實 JavaScript 開發人員的廣泛接受和採用:The following list shows the JavaScript frameworks and APIs for building immersive experiences that currently dominate the market and are widely accepted and adopted by Mixed Reality JavaScript developers:

Babylon.jsBabylon.js

Babylon 是 JavaScript 3D 引擎,可讓您輕鬆開發3D 內容和沉浸式應用程式。Babylon is a JavaScript 3D engine that makes developing 3D content and immersive applications easy. 開始使用沉浸式應用程式之前,建議您先瞭解 Babylon.js 開發的基本概念。Before getting started with immersive applications, we recommend to learn the basics of Babylon.js development.

-瞭解如何使用 babylon.js 入門來建立3d 應用程式。- Learn how to build 3D applications with babylon.js Getting started.
-使用 babylon.js遊樂場來播放3d 範例和其原始程式碼- Play with 3D examples and their source code using babylon.js Playground
-深入探索 WebXR- Dive deeper into WebXR
-瞭解如何開始使用我們的教學課程, 建立您的第一個「Hello World!」應用程式- Learn how to get started with our tutorials Create your first "Hello World!" app
BabylonJS 標誌
A 框架A-Frame

框架是一種宣告式的 JavaScript 架構,可讓您在網路中開始使用虛擬事實。A-frame is a declarative JavaScript framework to get started with Virtual Reality in the web. 若要深入瞭解,請參閱 框架檔Check out the A-Frame documentation to learn more.
A 框架
Three.jsThree.js

Three.js 是一種熱門的3D 程式庫,可讓您建立沉浸式體驗。Three.js is a popular 3D library for creating immersive experiences. 深入瞭解檔頁面中的 three.js ,以及探索 範例Learn more about three.js in documentation page and by exploring examples.
Three.js
WebGLWebGL

您可以使用 WebGL Api 直接存取 WebXR 裝置 Api。You can access the WebXR Device APIs directly by using WebGL APIs. WebGL (Web 圖形程式庫) 是一種 JavaScript API,可在任何相容的網頁瀏覽器內轉譯高效能的互動式3D 和2D 圖形,而不需要使用外掛程式。WebGL (Web Graphics Library) is a JavaScript API for rendering high-performance interactive 3D and 2D graphics within any compatible web browser without the use of plug-ins.
WebGL

另請參閱See Also