mirror of
https://github.com/BinomialLLC/basis_universal.git
synced 2026-06-08 00:23:52 +00:00
Update README.md
This commit is contained in:
@@ -1,26 +1,29 @@
|
||||
# WebGL Examples
|
||||
|
||||
Requires WebAssembly and WebGL support.
|
||||
Requires WebAssembly and WebGL support. The WebGL demos are hosted live [here](https://subquantumtech.com/uastchdr2/).
|
||||
|
||||
## Texture
|
||||
To build the encoder and transcoder WASM libraries using Emscripten, see the various README.md files in the 'webgl/transcoder' and 'webgl/encoder' folders.
|
||||
|
||||
Live demo: https://subquantumtech.com/uastchdr2/
|
||||
## texture_test
|
||||
|
||||
Live demo: [webgl/texture_test/index.html](https://subquantumtech.com/uastchdr2/texture_test/)
|
||||
|
||||
Renders a single texture, using the transcoder (compiled to WASM with emscripten) to generate one of the following compressed texture formats:
|
||||
|
||||
* ASTC
|
||||
* ASTC 4x4 LDR or HDR
|
||||
* BC1 (no alpha)
|
||||
* BC3
|
||||
* BC3, BC4 or BC5
|
||||
* ETC1 (no alpha)
|
||||
* PVRTC
|
||||
* PVRTC 4bpp
|
||||
* BC6H, BC7
|
||||
|
||||
On browsers that don't support any compressed texture format, there's a low-quality fallback code path for opaque textures. Note that the fallback path only converts to 16-bit RGB images at the moment, so the quality isn't as good as it should be.
|
||||
On browsers that don't support any compressed texture format, there's a low-quality fallback code path for opaque LDR textures, and a HDR half float or LDR 32bpp fallback code path for HDR textures.
|
||||
|
||||

|
||||

|
||||
|
||||
## glTF 3D Model
|
||||
|
||||
[Live demo: `gltf/index.html`](https://basis-universal-webgl.now.sh/gltf/)
|
||||
Live demo: [`gltf/index.html`](https://subquantumtech.com/uastchdr2/gltf/)
|
||||
|
||||
Renders a glTF 3D model with `.basis` texture files, transcoded into one of the following compressed texture formats:
|
||||
|
||||
@@ -38,22 +41,21 @@ extension that is [currently in development](https://github.com/KhronosGroup/glT
|
||||
|
||||

|
||||
|
||||
## Compressor (encode_test)
|
||||
## Compressor (ktx2_encode_test)
|
||||
|
||||
This demo shows how to use the compressor from JavaScript. To use it, select a .PNG file then hit the "Encode!" button. The compressor will dynamically generate a .basis file in memory which will then be immediately transcoded and displayed. Hit the "Download!" button to locally download the generated .basis file.
|
||||
Live demo: [`ktx2_encode_test/index.html'](https://subquantumtech.com/uastchdr2/ktx2_encode_test/)
|
||||
|
||||
This demo shows how to use the compressor from JavaScript. To use it, select a .PNG file then hit the "Encode!" button. The compressor will dynamically generate a .ktx2 file in memory which will then be immediately transcoded and displayed. Hit the "Download!" button to locally download the generated .ktx2 file.
|
||||
|
||||
To view the compressor's textual debug output, open your browser's developer debug console (under Developer Tools in Chrome) and enable the Debug checkbox before hitting the "Encode!" button. Multithreading is not currently supported when the compressor is compiled to WebAssembly, so compression will be slower than using the stand-alone command line tool.
|
||||
|
||||

|
||||

|
||||
|
||||
## Testing locally
|
||||
|
||||
See [how to run things locally](https://threejs.org/docs/#manual/en/introduction/How-to-run-things-locally), or (with [Node.js](https://nodejs.org/en/) installed), run:
|
||||
You can locally host the files under the "webgl" folder. One way is to use [Python to setup a local webserver](https://pythonbasics.org/webserver/) to setup a webserver in the 'webgl' directory.
|
||||
|
||||
```
|
||||
npx serve
|
||||
cd webgl
|
||||
python3 -m http.server 8000
|
||||
```
|
||||
|
||||
The console will display a `localhost` URL for local testing, and (on supported WiFi networks and devices) may also display an IP address accessible by other devices on the same network. Note that mobile devices must support WebAssembly to run this demo. Learn more about [remote debugging your android devices](https://developers.google.com/web/tools/chrome-devtools/remote-debugging/).
|
||||
|
||||
Alternately, use [Web Server for Chrome](https://chrome.google.com/webstore/detail/web-server-for-chrome/ofhbbkphhbklhfoeikjpcbhemlocgigb), browse to your local "webgl" directory, and then select 127.0.0.1:8887 under "Web Server URL(s).
|
||||
|
||||
Reference in New Issue
Block a user