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

Add support for loading AbadIA CSV heights files and build it #47

Closed
acs opened this issue Apr 30, 2020 · 20 comments
Closed

Add support for loading AbadIA CSV heights files and build it #47

acs opened this issue Apr 30, 2020 · 20 comments
Labels
Thing Build or Improve a Thing

Comments

@acs
Copy link
Contributor

acs commented Apr 30, 2020

STL is a format used for 3D printing. In the project In the project AbadIA they are reproducing the Abadia large building using STL generated from a CSV file with the heights data..

The idea is to read this STL files and reproduce them inside Minecraft. In this case they are using as unit building block a 1x1x1 block, just the same than in Minecraft. So It should be easy to recreate in Minecraft the building.

The steps are:

  • Load the cube STL inside MC to understand the format
  • Load the composition of two cubes inside MC
  • Load the level0 floor
  • Load all the floors
@acs acs added the Thing Build or Improve a Thing label Apr 30, 2020
@acs
Copy link
Contributor Author

acs commented Apr 30, 2020

Once the STL data is loaded inside MC, the next thing is to personalize the blocks used to build ech part of the Adabadia. For doing that, @bazarum is creating an AI that customize each block. How?
It is a GAN network that learns from photos the styles of builds. The AI can then transfer the style from the original Abadia images to the building inside MC.

Then you can train the AI to build one room, and after that, it can create the others room. A building AI sounds like a great idea.

@acs
Copy link
Contributor Author

acs commented Apr 30, 2020

Creating Scenes in MC using Things generated by AIs sounds ... cool!

@acs
Copy link
Contributor Author

acs commented Apr 30, 2020

There are two possible data input formats:

  • Height of points in CSV format: using it and based on a cube, the STL files are created. Probably is the faster approach, because it is just using the height of each point for dropping a block.
  • STL: the advantge of it is that it is a common format used in 3d printing. But if the models are not created using cubes, probably is not that useful for Minecraft

For a quick hack, the CSV format is the way to go. If we want just to support the building of the AbadIA, I would use the CSV data. But let's learn a bit about STL.

@acs acs changed the title Add support for loading AbadIA STL files Add support for loading AbadIA CSV/STL files Apr 30, 2020
@acs
Copy link
Contributor Author

acs commented Apr 30, 2020

The best approach to play with how the STL files are generated is to use the notebook: https://github.com/LaAbadIAdelCrimen/abadia-3d/blob/master/abadia_3d.ipynb Just open it in Colab, upload the heights file inside the notebook and start playing!

@acs
Copy link
Contributor Author

acs commented Apr 30, 2020

After playing a bit with STL files, the best thing is that you can view it in tools like Blender. The ntl-stl API does not seems to be pretty rich for building scenes. In the notebook the translate (move) is implemented directly.

Reading more about STL and ntl-stl there are big analogies with McThings:

  • A Mesh is a kind of Scene
  • You add mesh objects (Things) to a Mesh
  • You can rotate or move objects

So we can create STL scenes easily. And if we base them in cubes, they can be converted to McThings scenes and show inside Minecraft.

@acs
Copy link
Contributor Author

acs commented Apr 30, 2020

And we have arrived to thw world of STL importers to Minecraft!

And all of them are based on TinkerCAD (from Autodesk). You work inside TiinkerCAD the modelling and then export to Minecraft format (schematic) and insert into Minecraft using WorldEdit or MCEdit. Cool!

https://blog.tinkercad.com/2013/08/15/tinkercraft (2013)
https://medium.com/sandbox-game/voxedit-how-to-get-your-assets-into-minecraft-4be598b838f6 (2019)
https://www.instructables.com/id/Import-Custom-3D-Models-Into-Your-Minecraft-World/

And of course, you have also exporters: from Minecraft to STL.

People are working in programs for converting STL to MC Schematics

There are already options like https://minecraft.gamepedia.com/Programs_and_editors/Binvox that converts from stl (and other formats) to Schematics which can be imported in MC with MCEdit (and WordlEdit).

@acs
Copy link
Contributor Author

acs commented Apr 30, 2020

The process of converting a set of 3D polygons to their equivalents in blocks is called "voxelization" (https://minecraft.gamepedia.com/Programs_and_editors/Binvox)

@acs
Copy link
Contributor Author

acs commented Apr 30, 2020

I have learnt a lot about 3D modelling and Minecraft (for example, model in Blender, export to STL, use binvox to convert to schematics and import in MC using WorldEdit or MCEdit), but, is it clear if use the CSV file with the heights ot the STL file in order to import Abadia inside MC?

Creating scenes from STL models? That is really cool. McThings could compose incredible scenes with that. But for example, Blender can do the same composition.

What is the main advantage of Thigns in McThings vs STL or other voxelization formats? That Things can be created programming. Imagine creating a Pyramid in Blender for example. Probably you can create also programming based models in Blender.

Food for thought!

@acs
Copy link
Contributor Author

acs commented Apr 30, 2020

«https://www.reddit.com/r/Minecraft/comments/56a5zi/ive_been_working_on_a_program_to_convert_stl/d8hznu7/

Using the remesh modifier and the corners of a cube 231.015 units across, you can get a 1-to-1 block model in any shape and adjust it as needed.

edit: Forgot, set the mode to blocks and the octree depth to 8»

So you can convert any model to cubes! And then with binvox to a schematic and the import it in Minecraft.

@acs
Copy link
Contributor Author

acs commented Apr 30, 2020

My impression is that STL/3D/voxelization world is too wide to covert it in McThings yet.

So for this first approach, I will just add support for reading the CSV file with the heights and just build blocks for the ground to this height. In this way, we have total control over the process in order to tune it. It is the original data source (the STL file is creating from it) also. And I will continue exploring the import/export from MC using STL and others formats.

@acs
Copy link
Contributor Author

acs commented May 1, 2020

We are already loading the CSV files and drawing them in MC. We need to check that it is done correctly.
Screenshot from 2020-05-01 08-48-36

@acs
Copy link
Contributor Author

acs commented May 1, 2020

Once this support is finished adding support for loading files from Lidar should not be that hard: https://hackaday.com/2017/05/15/digitize-your-room-with-lidar/

@acs
Copy link
Contributor Author

acs commented May 1, 2020

Last version with the complete logic:
Screenshot from 2020-05-01 12-58-55

@acs
Copy link
Contributor Author

acs commented May 1, 2020

I will move all of this to mcthigs_extras because it is a bit experimental.

@acs
Copy link
Contributor Author

acs commented May 1, 2020

@acs
Copy link
Contributor Author

acs commented May 1, 2020

Final steps:

  • Control better the placement of the building
  • Add end_point so we can remove the Abadia easily
  • Add the walls and check that insde the Abadia you can move

@acs
Copy link
Contributor Author

acs commented May 1, 2020

All done:
Screenshot from 2020-05-01 19-24-41

@acs
Copy link
Contributor Author

acs commented May 1, 2020

Ok, I will close this ticket once @bazarum validates it.

@acs
Copy link
Contributor Author

acs commented May 1, 2020

Let's compare with the SML versions!

https://github.com/LaAbadIAdelCrimen/abadia-3d/blob/master/level0.stl

It is identical! Great! We can close now this ticket!

@acs acs closed this as completed May 1, 2020
@acs
Copy link
Contributor Author

acs commented May 1, 2020

It is going to be hard to reach the level of detail of the original game:

At the entry of the Abadia

@acs acs changed the title Add support for loading AbadIA CSV/STL files Add support for loading AbadIA CSV heights files and build it May 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Thing Build or Improve a Thing
Projects
None yet
Development

No branches or pull requests

1 participant