https://github.com/evolution-gaming/babylonjs-texture-generator
A tool that generates PVRTC, ETC1, ETC2, ASTC textures from png and jpg files.
https://github.com/evolution-gaming/babylonjs-texture-generator
astc babylonjs babylonjs-texture-generator etc1 etc2 pvrtc pvrtextoolcli textures
Last synced: about 1 year ago
JSON representation
A tool that generates PVRTC, ETC1, ETC2, ASTC textures from png and jpg files.
- Host: GitHub
- URL: https://github.com/evolution-gaming/babylonjs-texture-generator
- Owner: evolution-gaming
- License: apache-2.0
- Created: 2017-07-19T12:14:26.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-04-18T18:46:22.000Z (about 3 years ago)
- Last Synced: 2025-04-23T00:15:43.275Z (about 1 year ago)
- Topics: astc, babylonjs, babylonjs-texture-generator, etc1, etc2, pvrtc, pvrtextoolcli, textures
- Language: TypeScript
- Size: 34.2 KB
- Stars: 23
- Watchers: 6
- Forks: 8
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Babylonjs texture generator
## About
This is a tool that generates PVRTC, ETC1, ETC2, ASTC, DXT textures from png and jpg files. It can run on node or as a gulp task.
It is meant to work with [Babylon.js](https://github.com/BabylonJS/Babylon.js). The tool is a port of two [.bat files](https://github.com/BabylonJS/Babylon.js/tree/master/Tools/CompressedTextured).
## Installation
In order to use the tool, you need to have installed:
* PVRTexToolCLI ([download](https://www.imgtec.com/developers/powervr-sdk-tools/installers/))
* ASTC Evaluation Codec ([download](https://github.com/ARM-software/astc-encoder/tree/master/Binary))
* Add *ASTC Evaluation Codec* to your path, a process which depends on your OS. ([documentation](http://cdn.imgtec.com/sdk-documentation/PVRTexTool.User+Manual.pdf) at page 5)
* Run `npm run build` in terminal
## Usage
Import/require the exposed function `generateTextures` to your script. It accepts one argument as an object with the following attributes:
* `PVRTexToolCLI` - *string*: The absolute path to the PVRTexToolCLI tool.
* `inputDir` - *string*: The directory where the image files are located. It will be read recursively and all the images will be used in order to generate the new textures.
* `quality` - *string (optional), (options "low"/"high", default: "high")*: The quality of the exported textures.
* `exportFormats` - *string[] (optional) (options "PVRTC"/"ETC1"/"ETC2"/"ASTC"/"DXT", default: ["PVRTC", "ETC1", "ETC2", "ASTC", "DXT"])*: The format of the exported textures.
* `async` - *boolean (optional, default: false)*: Whether the task should run asynchronously.
Example usage:
```javascript
import generateTextures from "babylonjs-texture-generator";
// Alternatively
// const generateTextures = require("babylonjs-texture-generator");
createGpuTexture({
PVRTexToolCLI: "/Applications/Imagination/PowerVR_Graphics/PowerVR_Tools/PVRTexTool/CLI/OSX_x86/PVRTexToolCLI",
inputDir: "/src",
quality: "high",
async: false,
exportFormats: ["PVRTC", "ETC1", "ETC2", "ASTC", "DXT"]
});
```
### Limitations
Currently DXT files can not be exported on MacOS.