sbrl / Minetest-WorldEditAdditions

Extra tools and commands to extend WorldEdit for Minetest
https://worldeditadditions.mooncarrot.space/
Mozilla Public License 2.0
16 stars 3 forks source link

Export/Import textured 3d object from selection #59

Open VorTechnix opened 3 years ago

VorTechnix commented 3 years ago

This feature would allow export of scenes for render in blender, maya, 3ds etc.

TODO:

  1. Find a format or formats that can pack geometry and textures
  2. Narrow down format list to formats that are commonly importable by most 3d modeling programs
  3. Implement export of selection geometry and textures
  4. Implement conversion of export to previously listed formats
VorTechnix commented 3 years ago

We should also have the option to export geometry as loose cubes (allowing for "mining" and animating) or connected solid (faster export, less complex, smaller file size)

sbrl commented 3 years ago

Looks like the .obj format is probably the best one to choose. The definitive source on the format is actually wikipedia:

https://en.wikipedia.org/wiki/Wavefront_.obj_file

This article is also a great intro:

https://all3dp.com/1/obj-file-format-3d-printing-cad/

sbrl commented 3 years ago

Ha, found it! The spec for both .obj and .mtl: https://stackoverflow.com/a/11496625/1460422

...though Wikipedia might be more readable :P

sbrl commented 3 years ago

I've implemented 3 new classes:

The intention here is that together, these classes can serve as an intermediary between a mesh exporter / generator, and any potential output writers. This way, we can support more than 1 output file format in the future. It also allows for arbitrary transformations and optimisations to be performed on said mesh before it is passed to an exporter, thereby saving both computation time serialising and file size on disk.

Vector3, of course, should prove very useful indeed in many other places in the WorldEditAdditions codebase.

sbrl commented 2 years ago

Another thing worth investigating is importing. Since there's already a mod for exporting, it might be worth focusing on the importing process first before later moving on to integrate with the mod (whose name I forget) for exporting.

VorTechnix commented 2 years ago

...before later moving on to integrate with the mod (whose name I forget) for exporting.

I believe you mean Meshport. Also meshport export can be buggy at times especially in its mishandling of transparent nodes or clusters of them.

The Meshport code would need to be refined and better tested if we were to integrate it.

sbrl commented 2 years ago

Ah, by integrate it may be best to integrate with the mod - i.e. add an optional dependency on it - assuming it has a public API.