WebXR Samples

repository·main·Indexed 22 days ago

https://github.com/immersive-web/webxr-samples

A collection of WebXR samples featuring a lightweight WebGL rendering framework optimized for demonstrating WebXR concepts. The renderer supports loading GLTF 2.0 files and uses gl-matrix for math operations. The repository includes high-quality 3D assets, such as the Sponza model, with specific documentation on texture layout, mesh optimization, and tangent W component handling.

Tokens
488
Snippets
0
Records
4
Agent score
28%

What's inside webxr-samples

  1. Overview of the WebXR Samples Renderer

    main

    The WebXR Samples Renderer is a lightweight WebGL rendering framework specifically optimized for demonstrating WebXR concepts. Its primary functions are:

    1. Loading and Rendering GLTF 2.0 files.
    2. Optimizing for WebXR-style rendering.

    Important Note: This library is designed specifically to support the webxr-samples repository. It intentionally avoids wrapping WebXR functionality to ensure that the underlying WebXR API calls remain visible and easy to follow in code snippets.

    Warning: Using this renderer for independent production projects is not recommended. Developers should use more established and feature-rich WebGL/WebXR frameworks for general-purpose applications.

  2. Understand the Sponza glTF texture layout and optimizations

    main

    The Sponza glTF asset has been processed with the following modifications from the original source:

    • Texture Packing: Metallic and roughness textures are repacked into the glTF standard layout:
      • Green (G) channel: Roughness
      • Blue (B) channel: Metallic
    • Alpha Channels: Alpha mask textures have been merged into the diffuse texture's alpha channel.
    • Format: Textures are re-encoded as PNG (originally TGA).
    • Resolution: Alpha mask textures were resized to 1024x1024 to match the texture pack.
    • Optimizations: Vertices and indices have been processed through a mesh optimizer.
    • Material Constants: Materials include a constant diffuse factor of approximately 0.58.
  3. Dependencies and Module Support

    main

    The renderer has a minimal dependency footprint:

    • gl-matrix: The only third-party dependency used for math operations.
    • ES Modules: The library uses native JavaScript modules. No build step is required, as it is designed to run in WebXR-enabled browsers that support JS modules directly.