Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
G

glTF-Sample-Viewer

> 编程语言
Open source

Physically-Based Rendering in glTF 2.0 using WebGL

1.5K stars0 likes1 views
WebsiteGitHub

About

Physically-Based Rendering in glTF 2.0 using WebGL

glTF Sample Viewer Web App

This is the official Khronos glTF 2.0 Sample Viewer using WebGL 2.0:

Viewer

Link to the live glTF 2.0 Sample Viewer.

Features

glTF

  • glTF 2.0
  • KHR_accessor_float64
    • Animations
    • KHR_animation_pointer
    • Mesh Attributes not supported since WebGL2 only supports 32 bit
    • Skins not supported since WebGL2 only supports 32 bit
  • KHR_animation_pointer
  • KHR_draco_mesh_compression
  • KHR_implicit_shapes
  • KHR_interactivity
  • KHR_gaussian_splatting
  • KHR_lights_punctual
  • KHR_materials_anisotropy
  • KHR_materials_clearcoat
  • KHR_materials_diffuse_transmission
  • KHR_materials_dispersion
  • KHR_materials_emissive_strength
  • KHR_materials_ior
  • KHR_materials_iridescence
  • KHR_materials_pbrSpecularGlossiness
  • KHR_materials_sheen
  • KHR_materials_specular
  • KHR_materials_transmission
  • KHR_materials_unlit
  • KHR_materials_variants
  • KHR_materials_volume
  • KHR_materials_volume_scatter
    • For dense volumes using KHR_materials_diffuse_transmission
    • For sparse volumes using KHR_materials_transmission
  • KHR_meshopt_compression
  • KHR_mesh_quantization
  • KHR_node_hoverability
  • KHR_node_selectability
  • KHR_node_visibility
  • KHR_physics_rigid_bodies
    Supported Engines:
    • NVIDIA PhysX (limitations)
  • KHR_texture_basisu
  • KHR_texture_transform
  • KHR_xmp_json_ld
  • EXT_mesh_gpu_instancing
  • EXT_meshopt_compression
  • EXT_texture_webp

UI

  • Select all glTF-Sample-Assets directly via UI
  • Load your own glTF/glb and HDR files via drag and drop
  • Customize lighting and tone mapping
  • Check validation errors with the integrated glTF-Validator
  • Select different material variants
  • Enable/disable specific animations
  • Enable/disable glTF features/extensions and view debug channels
  • Download renderings and current camera properties
  • Show statistics about the currently loaded file
  • Specify URL parameters to modify behavior on load
  • The Physics tab will only be visible if a loaded glTF contains the KHR_physics_rigid_bodies extension. It provides functionality to enable/disable/reset the physics simulation, select a physics engine, manually step through the simulation and enable/disable debug visualization.

Usage

Controls

click + drag : Rotate model

shift + drag
middle mouse button + drag : Pan camera

scroll
right click + drag : Zoom camera

GUI : Use to change models and settings

Change glTF model

  • Choose one of the glTF models in the selection list
  • Drag and drop glTF files into viewer

Change the environment map

  • Drag and drop a .hdr panorama file

URL parameters

URL parameters are added at the end of the sample viewer URL:
?key=value&another_key=another_value

Possible parameters:

  • model=URL_to_file: Load glTF/glb from specified URL
  • noUI: Disable UI
  • yaw=90: Orbit the camera around the model along the Y-axis in degrees. With 90 degrees you look at the model from the left side.
  • pitch=90: Orbit the camera around the model along the X-axis in degrees. With 90 degrees you look at the model from the top. Value range: -90 to 90
  • distance=5: The models gets smaller with positive and bigger with negative numbers. Relative to the initial camera position.

Setup

For local usage and debugging, please follow these instructions:

  1. Checkout the main branch

  2. Pull the submodule for the required glTF-Sample-Renderer git submodule update --init --recursive

  3. Build the web app

    • run npm install
    • start a demo in the browser with npm run dev, and open http://localhost:8000.

When making changes, the project is automatically rebuilt and the ./dist directory is populated with the web app. This directory contains all files necessary for deployment to a webserver.

Debugging

  • Requirements
    • Visual Studio Code or vscodium
    • Chrome or Firefox
  • Install the Debugger for Chrome or Debugger for Firefox extension for Visual Studio Code
  • Open the project directory in Visual Studio Code and select Debug->Add Configuration->Chrome or Debug->Add Configuration->Firefox so the .vscode/launch.json file is created.
  • For chrome: Append /dist to ${workspaceFolder} in the launch.json file
  • Debug->Start Debugging should now launch a Chrome or Firefox window with the sample viewer and VS Code breakpoints should be hit.

Known Issues

npm install / npm run dev give the following warnings:

The following warning comes from a thirdparty and does not affect sample viewer since the mentioned line 179 is never executed.

(!) "this" has been rewritten to "undefined"
https://rollupjs.org/troubleshooting/#error-this-is-undefined
node_modules/iobuffer/lib-esm/text-encoding-polyfill.js
177:     : typeof self !== 'undefined'
178:         ? self
179:         : this);
               ^
180: //# sourceMappingURL=text-encoding-polyfill.js.map

The following warning is caused by an old bulma version, which buefy-next currently depends on. This should be fixed in an upcoming release: https://github.com/ntohq/buefy-next/issues/208

…

The following warnings stem from the rollup copy plugin, which is only used for development to copy files to the dist folder.

…

Formatting

This repository uses Prettier for code formatting and ESLint for linting.

To check the formatting and linting of the code run:

bash
npm run format

Prettier and ESLint are configured to only run on files in the "source" folder and ignore files in "source/libs".

Visual Studio Code

There are extensions for both Prettier and ESLint in Visual Studio Code. They can be found in the marketplace:

  • Prettier - Code formatter
  • ESLint

You are encouraged to run Prettier and ESLint on your code before committing.

Issues· 16 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

JavaScript

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言