From 7a5d22852cfa0e1bce776d006410a87beef343dc Mon Sep 17 00:00:00 2001 From: Rich Geldreich Date: Tue, 10 Sep 2024 16:47:03 -0400 Subject: [PATCH 1/4] Update README.md --- webgl/README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/webgl/README.md b/webgl/README.md index 79b6cb90..f99401a0 100644 --- a/webgl/README.md +++ b/webgl/README.md @@ -4,9 +4,7 @@ Requires WebAssembly and WebGL support. ## Texture -[Live demo: `texture/index.html`](https://basis-universal-webgl.now.sh/texture/) - -(Note the Live texture demo hasn't been updated to the latest release yet.) +Live demo: https://subquantumtech.com/uastchdr2/ Renders a single texture, using the transcoder (compiled to WASM with emscripten) to generate one of the following compressed texture formats: From 88e4a8087ac189e00c6991ec0a9d04ce81061fcf Mon Sep 17 00:00:00 2001 From: Rich Geldreich Date: Tue, 10 Sep 2024 17:00:52 -0400 Subject: [PATCH 2/4] Update README.md --- webgl/README.md | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/webgl/README.md b/webgl/README.md index f99401a0..7010274d 100644 --- a/webgl/README.md +++ b/webgl/README.md @@ -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. -![Screenshot showing a basis texture rendered as a 2D image in a webpage.](texture/preview.png) +![Screenshot showing a basis texture rendered as a 2D image in a webpage.](texture_test/preview.png) ## 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 ![Screenshot showing a basis texture rendered as the base color texture for a 3D model in a webpage.](gltf/preview.png) -## 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. -![Screenshot showing the encode_test demo](encode_test/preview.png) +![Screenshot showing the encode_test demo](ktx2_encode_test/preview.png) ## 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). From 4269074010c8e30d1a436e4c839c6190e084b5db Mon Sep 17 00:00:00 2001 From: Rich Geldreich Date: Tue, 10 Sep 2024 17:02:56 -0400 Subject: [PATCH 3/4] Update README.md --- webgl/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webgl/README.md b/webgl/README.md index 7010274d..9dfa491f 100644 --- a/webgl/README.md +++ b/webgl/README.md @@ -2,9 +2,9 @@ Requires WebAssembly and WebGL support. The WebGL demos are hosted live [here](https://subquantumtech.com/uastchdr2/). -To build the encoder and transcoder WASM libraries using Emscripten, see the various README.md files in the 'webgl/transcoder' and 'webgl/encoder' folders. +To build the encoder and transcoder WASM libraries using Emscripten, see the various README.md files in the 'webgl/transcoder' and 'webgl/encoder' folders. The Javascript API wrappers to the C/C++ library are located in [`webgl/transcoder/basis_wrappers.cpp`](https://github.com/BinomialLLC/basis_universal/blob/master/webgl/transcoder/basis_wrappers.cpp). -## texture_test +## Transcoder (texture_test) Live demo: [webgl/texture_test/index.html](https://subquantumtech.com/uastchdr2/texture_test/) From 051ad6d8a64bb95a79e8601c317055fd1782ad3e Mon Sep 17 00:00:00 2001 From: Rich Geldreich Date: Tue, 10 Sep 2024 17:12:38 -0400 Subject: [PATCH 4/4] Update README.md --- README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 46f0ccb9..dfb7bfa1 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Links - [Release Notes](https://github.com/BinomialLLC/basis_universal/wiki/Release-Notes) -- [Online WebGL Examples](https://subquantumtech.com/uastchdr2/) +- [Javascript API/WASM/WebGL info](https://github.com/BinomialLLC/basis_universal/tree/master/webgl), and the [live encoder/transcoder WebGL examples](https://subquantumtech.com/uastchdr2/) - [UASTC HDR Example Images](https://github.com/BinomialLLC/basis_universal/wiki/UASTC-HDR-Examples) @@ -204,7 +204,7 @@ The written mipmapped, cubemap, or texture array .KTX/.DDS files will be in a wi WebGL Examples -------------- -The "WebGL" directory contains three simple WebGL demos that use the transcoder and compressor compiled to [WASM](https://webassembly.org/) with [emscripten](https://emscripten.org/). These demos are online [here](https://subquantumtech.com/uastchdr2/). See more details [here](webgl/README.md). +The 'WebGL' directory contains four simple WebGL demos that use the transcoder and compressor compiled to [WASM](https://webassembly.org/) with [emscripten](https://emscripten.org/). These demos are online [here](https://subquantumtech.com/uastchdr2/). See more details in the readme file [here](webgl/README.md). ![Screenshot of 'texture' example running in a browser.](webgl/texture_test/preview.png) ![Screenshot of 'gltf' example running in a browser.](webgl/gltf/preview.png) @@ -256,6 +256,13 @@ You can download and install Basis Universal using the [vcpkg](https://github.co The Basis Universal port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository. (9/10/2024: UASTC HDR support is not available here yet.) +License +------- + +The transcoder and core encoder libraries are Apache 2.0. The transcoder utilizes no 3rd party libraries or dependencies. See [LICENSE](https://github.com/BinomialLLC/basis_universal/blob/master/LICENSE). + +The encoder library is Apache 2.0, but it utilizes some open source 3rd party helper modules (in 'encoder/3rdparty' and in the 'Zstd' directory) to load .QOI, .DDS, .EXR images, to handle Zstd compression, and to unpack ASTC texture blocks. See the [LICENSES](https://github.com/BinomialLLC/basis_universal/tree/master/LICENSES) folder. + Repository Licensing with REUSE -------------------------------