ObjToSchematic/README.md

140 lines
7.8 KiB
Markdown
Raw Normal View History

2022-03-21 08:01:44 +08:00
<h1>
<p align="center">
2022-03-24 06:46:36 +08:00
<img src="res/static/icon.png" alt="Logo" width="64" height="64">
2022-03-21 08:01:44 +08:00
<br>
ObjToSchematic
</p>
</h1>
<p align="center">
2022-07-11 07:01:24 +08:00
A visual tool to convert 3D .obj models into Minecraft structures (.schematic, <a href="https://www.curseforge.com/minecraft/mc-mods/litematica/files">.litematic</a>, <a href="https://github.com/SpongePowered/Schematic-Specification">.schem</a>, .nbt)
2022-03-21 08:01:44 +08:00
<br>
<a href="#usage">Usage</a>
<a href="#progress">Progress</a>
<a href="#disclaimer">Disclaimer</a>
2022-03-24 08:10:13 +08:00
<a href="#contributing">Contributing</a>
<a href="#gallery">Gallery</a>
2022-03-21 08:01:44 +08:00
</p>
<p align="center">
2022-04-05 03:02:27 +08:00
<img src="https://github.com/LucasDower/ObjToSchematic/actions/workflows/build.js.yml/badge.svg" alt="Logo">
<img src="https://github.com/LucasDower/ObjToSchematic/actions/workflows/tests.js.yml/badge.svg" alt="Logo">
2022-03-21 08:01:44 +08:00
</p>
2021-07-01 23:25:27 +08:00
2022-03-22 09:56:53 +08:00
![Preview](https://i.imgur.com/HgQaEIO.png)
2022-02-20 06:37:08 +08:00
<sub>"Homo erectus georgicus" (https://skfb.ly/6ADT8) by Geoffrey Marchal is licensed under Creative Commons Attribution-NonCommercial (http://creativecommons.org/licenses/by-nc/4.0/).</sub>
2021-07-01 23:25:27 +08:00
## Usage
2022-03-22 09:51:31 +08:00
You can either download the [latest release](https://github.com/LucasDower/ObjToSchematic/releases) or if you want the latest features you can build it yourself by following the instructions below.
2021-10-30 04:09:58 +08:00
* Download and install [Node.js](https://nodejs.org/en/).
* Run `git clone https://github.com/LucasDower/ObjToSchematic.git` in your command line.
* Navigate to `/ObjToSchematic-main`.
* Run `npm install`.
* Run `npm start`.
2022-02-20 06:52:54 +08:00
### Advanced
2021-07-07 09:35:12 +08:00
2022-03-22 09:51:31 +08:00
#### Block Palettes
2022-03-24 06:46:36 +08:00
You can create your own block palettes to fit the build you desire. When you select this palette, the generated structure will only use the blocks defined in your palette. To create a palette, list every block you want to use in `/tools/new-palette-blocks`. A list of every supported block can be found in `/tools/all-supported-blocks`. When your list is complete, run `npm run palette`, (make sure you run `npm run build` before the first time you do this). If everything is successful, the next time you run the program you'll be able to select your new palette in the 'Block palette' dropdown.
2022-03-22 09:51:31 +08:00
#### Texture Atlases
2022-03-23 05:15:09 +08:00
If you play Minecraft with a resource pack, you will probably want to build your own texture atlas. This way the program will use the same resource pack for its visualisation and more accurate colour-to-block conversions can be made. To do this, run `npm run atlas` (make sure you run `npm run build` before the first time you do this) and follow the instructions. If everything is successful, the next time you run the program you'll be able to select your resource pack in the 'Texture atlas' dropdown.
#### Headless
If you want to use the program without using the GUI, you can edit `/tools/headless-config.ts` and run `npm run headless` (make sure to run `npm run build` after **each time** you edit the `headless-config.ts`).
2022-02-20 06:52:54 +08:00
## Progress
2021-07-07 09:35:12 +08:00
[0.1](https://github.com/LucasDower/ObjToSchematic/releases/tag/v0.1-alpha)
2021-11-14 21:32:41 +08:00
* 🟢 **.json model loading**
* 🟢 **Model voxelisation**
* 🟢 **Optimised voxelisation & rendering overhaul**
* 🟢 **Basic .obj file loader UI**
2021-07-04 00:41:01 +08:00
2021-07-07 09:35:12 +08:00
[0.2](https://github.com/LucasDower/ObjToSchematic/releases/tag/v0.2-alpha)
2021-11-14 21:32:41 +08:00
* 🟠 <s>**Greedy voxel meshing**</s> (Removed)
* 🟢 **Export to schematic**
2021-07-04 00:41:01 +08:00
2021-08-20 23:19:01 +08:00
[0.3](https://github.com/LucasDower/ObjToSchematic/releases/tag/v0.3-alpha)
2021-11-14 21:32:41 +08:00
* 🟠 <s>**Voxel splitting**</s> (Removed)
* 🟢 **Ambient occlusion**
* 🟢 **Quality of life**
* Model PSR, height limit warnings
* 🟢 **.mtl support for block choice**
* PNG support, JPEG support
* 🟢 **Convert to TypeScript**
2021-07-07 09:35:12 +08:00
2022-01-18 03:30:39 +08:00
[0.4](https://github.com/LucasDower/ObjToSchematic/releases/tag/v0.4-alpha)
2022-01-16 10:35:46 +08:00
* 🟢 **Block choice exported**
2021-11-14 21:32:41 +08:00
* Export to .litematic
* 🟢 **Support for non-uniform block models** (i.e. not all sides have same texture e.g. Oak Log, Crafting Table)
2022-01-18 03:30:39 +08:00
* 🟢 **UI Redesign**
2021-11-14 21:32:41 +08:00
* 🟢 **Optimised ambient occlusion**
* 🟢 **Transition to ray-based voxelisation**
2021-11-20 03:01:21 +08:00
* 🟢 **Dithering**
2021-07-04 00:41:01 +08:00
2022-04-01 04:35:50 +08:00
[0.5](https://github.com/LucasDower/ObjToSchematic/releases/tag/v0.5-alpha)
2022-02-20 09:28:08 +08:00
* 🟢 **Load custom block palettes and texture atlases**
2022-04-01 04:35:50 +08:00
* Added custom tool scripts for building atlases and palettes
* 🟢 **Major refactor for extendibility**
* New interfaces: IImporter, IVoxeliser, IBlockAssigner, IExporter
* 🟢 **QoL editor impovements**
* Switch between Mesh/Voxel Mesh/Block Mesh rendering, zoom accessibility options, camera translation/centreing
* Debug draw options: grid, wireframe, normal, voxel algorithm debug
* 🟢 **Headless launch option**
* 🟢 **New voxelising algorithms**
* Normal-corrected ray-based (NCRB)
* BVH-accelerated ray-based
2022-02-20 09:28:08 +08:00
* 🟢 **Optimise construction of voxel mesh vertex buffers**
2022-04-01 04:35:50 +08:00
* 🟢 **Buffer refactor to support `OES_element_index_uint` WebGL extension (support for uint32 index buffers instead of uint16)**
0.6
2022-07-11 06:49:59 +08:00
* 🟢 **Options for handling falling blocks and overlapping voxels**
* 🟢 **Sponge schematics exporter (.schem)**
* 🟢 **Structure blocks exporter (.nbt)**
2022-09-11 02:39:31 +08:00
* 🟢 **Web workers**
* Processing UI animation
2022-01-19 09:08:05 +08:00
* Prevent UI hanging
2022-07-15 01:11:28 +08:00
* 🟢 Alpha support
2022-01-16 10:35:46 +08:00
* Alpha texture maps
* Transparent blocks
2022-04-01 04:35:50 +08:00
* ⚪ Importers for .fbx and .gltf
2021-08-03 02:05:44 +08:00
2022-04-01 04:35:50 +08:00
0.7
2022-09-09 20:23:43 +08:00
* ⚪ Support for simplifying complex meshes
* ⚪ Node.js C++ addons
2021-11-14 21:32:41 +08:00
* ⚪ Block painting
* ⚪ Building guides
* ⚪ Slice viewer
* ⚪ Support for non-block models (e.g. slabs, stairs, trapdoors, etc.)
## Disclaimer
2021-09-11 08:04:56 +08:00
:warning: This repo is in development and proper error handling is not currently my priority. Contributions are welcome.
2021-07-23 23:39:29 +08:00
This is an non-commercial **unofficial** tool that is neither approved, endorsed, associated, nor connected to Mojang Studios. Block textures used are from Minecraft and usage complies with the [Mojang Studios Brand And Assets Guidelines](https://account.mojang.com/terms#brand).
2021-09-11 02:27:05 +08:00
2022-02-21 06:32:17 +08:00
![MinecraftPreview](https://i.imgur.com/LhTZ4G9.png)
2021-11-07 04:38:33 +08:00
## Contributing
2022-02-20 09:28:08 +08:00
Any contributions are welcome, just fork and submit a PR! Just make sure the code style follows the rulings in the `.eslintrc.json` and pass the CI build task.
2022-09-09 20:23:43 +08:00
Currently there's not much docs but if you're looking for where to get started, look at `app_context.ts` and follow `_import()`, `_voxelise()`, `_assign()`, and `_export()`. If you're looking to add elements to the UI, look at `ui/layout.ts`, I'm not using a UI framework because I'm a nutter. Adding more file formats to import from and export to would be nice. Adding new default block palettes would be great also.
2022-02-20 09:28:08 +08:00
If you have any questions or need help getting started then feel free to join the [Discord](https://discord.gg/McS2VrBZPD) or message me **SinJi#4165**.
2022-02-20 09:28:08 +08:00
### Debugging
2021-11-07 04:38:33 +08:00
To allow for your favourite debugging tools like breakpoints and call stacks, I've included launch options for debugging in VSCode. Use `Ctrl+Shift+D`, and run "*Debug Main Process*" and once the Electron window has initialised, run "*Attach to Render Process*".
2022-03-24 08:10:13 +08:00
## Gallery
<p align="center">
<img src="https://i.imgur.com/wmNQnkN.png" alt="Gallery1" width="600"><br>
<sub>"Creepy Lady Bust Statue Scan" (https://skfb.ly/6B7pK) by alex.toporowicz is licensed under Creative Commons Attribution (http://creativecommons.org/licenses/by/4.0/).</sub>
<br>
<img src="https://imgur.com/oewDRvM.png" alt="Gallery2" width="600"><br>
<sub>"Cut Fish" (https://skfb.ly/orWLC) by Suushimi is licensed under Creative Commons Attribution-NonCommercial (http://creativecommons.org/licenses/by-nc/4.0/).</sub>
<br>
<img src="https://imgur.com/SF33FGa.png" alt="Gallery3" width="600"><br>
<sub>"Pivot Demo: Journey" (https://skfb.ly/6WCIJ) by Sketchfab is licensed under Creative Commons Attribution (http://creativecommons.org/licenses/by/4.0/).</sub>
<br>
<img src="https://imgur.com/7domJdr.png" alt="Gallery4" width="600"><br>
<sub>"Handpainted Pancake" (https://skfb.ly/6T7yN) by Marvi is licensed under Creative Commons Attribution (http://creativecommons.org/licenses/by/4.0/).</sub>
</p>