Skip to content

About

Physically-Based Rendering in glTF 2.0 using WebGL

Resources

Code of conduct

Contributing

Stars

1.5k stars

Watchers

60 watching

Forks

Latest commit

 

History

3,229 Commits

Folders and files

Repository files navigation

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

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

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 web server.

Debugging

  • Requirements
  • 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.

Formatting

Running npm run format normalizes formatting and prints linting issues, fixing if possible.

About

Physically-Based Rendering in glTF 2.0 using WebGL

Resources

Code of conduct

Contributing

Stars

1.5k stars

Watchers

60 watching

Forks

Releases

Packages

Used by

Contributors

Languages