Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readme improvements #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,36 @@
### Hubs Glb Tools
This is the official Hubs Glb tools based on glTF Transform tools which provides fast, reproducible, and lossless control of the low-level details in a 3D model. The API automatically manages array indices and byte offsets, which would otherwise require careful management when editing files.
It allows us to GPU compress the texture using ktx and optimises the glb files without losing the 'Hubs Components' as well
Hubs Glb Tools is based on glTF Transform, which provides fast, reproducible, and lossless control of the low-level details in a 3D model. The API automatically manages array indices and byte offsets, which would otherwise require careful management when editing the files.
Hubs Glb Tools allows you to GPU compress the textures in your GLB files using KTX and optimize the GLB files without losing the 'Hubs Components'.


### Prerequisites
Download and install the KTX tools from the [official KTX Software repository](https://github.com/KhronosGroup/KTX-Software)

### Installation
1. Clone the repository
`git clone https://github.com/Hubs-Foundation/hubs-glb-tools`
2. Download & Install ktx tools from the [official repository](https://github.com/KhronosGroup/KTX-Software)
3. Change your directory to the cloned folder `cd hubs-glb-tools`, and then run `npm install` with a node version of 18.18
2. Change your directory to the cloned folder `cd hubs-glb-tools`, and then run `npm install` with a node version of 18.18


### Usage Instructions
1. Start the tool by running `npm run dist`
2. And in the new terminal instance run the command to generate a new output.glb
Run this command to generate a new optimized output.glb
`node --no-experimental-fetch bin/cli.js optimize /Users/.../hubs-glb-tools/input.glb /Users/.../output.glb`

Note:
1. It needs absolute glb file's path as the input & output
2. the [--no-experimental-fetch](https://github.com/node-fetch/node-fetch/issues/1566) is required for node versions 18 and up
The [--no-experimental-fetch](https://github.com/node-fetch/node-fetch/issues/1566) option is required for node versions 18 and up, it needs absolute file paths for the input and output GLBs.


<!-- TODO: ADD information for different compression types -->
## Compression Types
The command `node /bin/cli.js optimize input.glb output.glb --ktx {{compression type}}` is used to optimize a GLB file by applying texture compression using the KTX format. This command supports various compression types, each with different characteristics:
The command `node --no-experimental-fetch /bin/cli.js optimize input.glb output.glb --ktx {{compression type}}` is used to optimize a GLB file by applying texture compression using the KTX format. This command supports various compression types, each with different characteristics:

`node /bin/cli.js optimize input.glb output.glb --ktx auto`
`node --no-experimental-fetch /bin/cli.js optimize input.glb output.glb --ktx auto`
Auto: This option automatically selects the compression type based on the texture type. For standard textures, it uses ETC1S compression, which provides a balance between file size and quality. For normal maps, it opts for UASTC compression, which preserves more detail, albeit with a larger file size.

`node /bin/cli.js optimize input.glb output.glb --ktx etc1s`
`node --no-experimental-fetch /bin/cli.js optimize input.glb output.glb --ktx etc1s`
ETC1S: This compression type is designed to minimize file size, making it ideal for scenarios where storage or bandwidth is a concern. However, it offers lower quality compared to UASTC, which might result in a slight loss of detail in the textures.

`node /bin/cli.js optimize input.glb output.glb --ktx uastc`
UASTC: This option is focused on maintaining higher quality, especially for textures where detail is critical. It results in larger file sizes, but the visual fidelity is significantly better, making it suitable for applications where quality is a priority.
`node --no-experimental-fetch /bin/cli.js optimize input.glb output.glb --ktx uastc`
UASTC: This option is focused on maintaining higher quality, especially for textures where detail is critical. It results in larger file sizes, but the visual fidelity is significantly better, making it suitable for applications where quality is a priority.

Note:
KTX compressed GLB files can't be imported by Blender currently.