guillaumechereau / goxel

Goxel: Free and Open Source 3D Voxel Editor
GNU General Public License v3.0
2.78k stars 222 forks source link

importing a section of a Minetest world? #89

Open ThomasMonroe314 opened 6 years ago

ThomasMonroe314 commented 6 years ago

Hello everyone in the goxel team! I contribute to the Minetest project some and I had a really interesting idea. What if there was a mode on goxel that allows one to import a specified section of a Minetest map?

guillaumechereau commented 6 years ago

The problem is that at the moment, goxel doesn't support textured voxels, so I am not sure how it would look like. If you know how to code you can give it a try though. You can have a look for example at the qubicle import functions to see how it's done (src/formats/qubicle.c)

ThomasMonroe314 commented 6 years ago

Ah, that makes sense. I won't be able to give it a try right now because I have some PR's on Minetest that I'm working on.

BrianGaucher commented 6 years ago

I've tried using this to make some meshes for Minetest. But one Goxel voxel is equivalent of a Minetest node. If there was an add-on, or an export option for Minetest with textures removed, and which would offer to scale it down (1/16 is the convention, some hi-quality use more). That would make mesh creation much easier. I don't know how hard it would be though.

guillaumechereau commented 6 years ago

Sorry I never checked into minetest. What is a minetest node? Any reference to the format used in minetest?

BrianGaucher commented 6 years ago

I'm not qualified to write this since I don't even know how to make the meshes for Minetest, and I don't know C either. But Minetest is a voxel game (much like Minecraft, except still in beta and open-source, and the default game is itself a mod). but a node is like a cube. Usually we used touse multiple nobeboxes to define the shape of that node (for example a stair, has one nodebox full-width, full-length, and bottom half-height. Then another nodebox which is half-length, full-width, and the top half of the height). But since 0.3 meshes can be used to optimise the faces and create complex shapes. many modders use blender. But goxel would work so well since it's simple, and forces you to use cubes (no slopes). I know that a mesh should be up-to 111 (some mods will use odd shapes to overlap), so exporting would be .obj and it would shrink so that the entire mesh is 111, rather than 646464. And then textures are removed (since Minetest uses separate textures). And it must also be a single face or 6 faces probably. Goxel would make hi-quality models so easy to make. resources: http://wiki.minetest.com/wiki/Using_Blender https://rubenwardy.com/minetest_modding_book/en/chapters/node_drawtypes.html Here is a sample mesh (can't be opened in goxel, requires blender) FM_tv.obj.zip

I'll try to use blender to create some meshes, maybe learn the mesh file format, then I'll try to make a tool to convert .obj goxel generates into .obj minetest can use. If I do that maybe after I'll be able to help you more. I should probably learn C or C++ though, I'm still using java.

guillaumechereau commented 6 years ago

I am still not quite sure. I think one way of doing what you want is to first export to obj from goxel, and then scale the model in blender to the size needed for minetest.

BrianGaucher commented 6 years ago

I have no idea either. I'll keep experimenting with modding, and try using meshes, (Youtube will help). Maybe later if I know how it works I'll see if it's possible to streamline from goxel to minetest. For the moment I can't do anything. If exporting from goxel to minetest could work, that would be appreciated by many modders though. Here is another link https://wiki.minetest.net/Using_Blender

SHMAUS-Carter commented 5 years ago

You might be able to use the minetest export plugin to export to obj or slt then import to goxel

bztsrc commented 4 years ago

Hi,

The problem is that at the moment, goxel doesn't support textured voxels, so I am not sure how it would look like.

It's not that problematic, substituting by an average color works fine imho. The real issue here is that Minetest palettes store names in strings instead of RGBA color codes, and they also need other properties like rotation info and probability values too. An extra difficulty, that those node names are not canonized, they depend on the Minetest world (which game and mods were enabled), so for example the same voxel sometimes is saved as "default:brick" and sometimes as "mcl_core:brick_block" in the palette.

Any reference to the format used in minetest?

https://dev.minetest.net/Minetest_Schematic_File_Format (the "official" spec, quite brief) https://gitlab.com/bztsrc/mtsedit/blob/master/docs/mts_format.md (unofficial, but more detailed)

What if there was a mode on goxel that allows one to import a specified section of a Minetest map?

I actually have a partial solution to that. See https://gitlab.com/bztsrc/mtsedit/

My Minetest schematic editor is far from Goxel in terms of available features, but it automatically assigns color codes to nodes, and it can export GIMP palettes, which then can be loaded into Goxel. The editor is also capable of importing Goxel GOX files, or convert them into MTS in batch mode. By default it looks up the name in the specified mapping which is the closest match to a voxel's color, but if you use the provided GIMP palette in Goxel, then you'll always have exact node matches (you still have to select a node name mapping). Other than that, it calculates probability values (always 100% for non-air nodes and air nodes inside rooms, and always 0% for air nodes outside), and sets rotation info to a constant facing north (which you can then fix in the editor before you save it in MTS format).

This works for the Goxel to Minetest workflow. There's no solution to the other way around: Minetest to Goxel is not possible as of yet (but I might add an MTS to something Goxel can read converter into my editor).

Cheers, bzt