1. We've removed some functionality from SMD in preparation for a migration to new forum software. We expect to make the move before August.

    Vox2Smtpl: convert MagicaVoxel .vox to .smtpl

    Discussion in 'Mods' started by Jojomo, Oct 13, 2017.

    1. Jojomo

      Joined:
      Aug 23, 2016
      Messages:
      758
      Vox2Smtpl is a small program that converts MagicaVoxel .vox model files to StarMade .smtpl files.

      This means you can take advantage of the power and convenience of modelling a ship or part in MagicaVoxel, and importing it into StarMade. Modelling in MagicaVoxel is much, much faster than modelling in StarMade directly.

      Here's a small example:

      [​IMG]




      INSTRUCTIONS

      Installation
      1. Download Vox2Smtpl and MagicaVoxel (note I have no affiliation or connection with MagicaVoxel or its author)
      2. From the Vox2Smtpl zip file place the editor.ui file in MagicaVoxel's /config folder (overwrite existing file)
      3. Place the pal0.png file in MagicaVoxel's /palette folder (overwrite existing file)

      Usage
      4. Start MagicaVoxel and in the left Palette column click either the "0" button at the top or the "Load" button at the bottom to load the pal0.png custom palette
      5. Create your model in MagicaVoxel, save it (note the red axis, x, is length, the blue is height, green is width)
      6. Double click VoxToSmtpl_v01.jar to run it (get Java for 64 bit Windows here if you don't already have it)
      7. Click "Load" and select your .vox file
      8. Click "Save" to create a corresponding .smtpl file
      9. Make sure your .smtpl file is in your StarMade install location in the /Templates folder
      10. When in build mode for a ship, enter advanced build mode, choose your template in Selection, click Load, and Paste



      POSSIBLE FUTURE FEATURES


      These will probably depend on demand, my personal needs, how big a job they are, and my free time. (let me know which you'd most like to see)
      - Auto-wedging during conversion
      - Conversion in the other direction: .smtpl to .vox
      - Conversion to a full blueprint instead of a template
      - Have the palette be read from a text file so users can easily modify it themselves
      - Show more ship stats during conversion
      - Should I alter the axes used in MV to have the same labels as in SM? I.e. "x", "y", "z" - user opinions required.
      - Update so that multi-layer files created by VoxelShop will also work correctly
      - Auto-creation of "template-placing-guide template file" during conversion for easy pasting of templates around a ship core at a desired location: paste the "guide" to the back of the core, then paste the ship template to the back of the guide. Easy way to avoid the frustration of getting a SM template to paste exactly where you want it.




      DISCUSSION/LIMITATIONS


      I created this program because I get frustrated with the slow speed of modelling/designing directly in SM.
      Vox2Smtpl isn't a complete solution (although it's enough of one for me to start playing again), some obvious ones being no wedges etc., and no way of linking blocks (e.g. computers with modules).
      And of course parts of what it and MV do together aren't perfect (MV's an existing tool repurposed for a task, not a custom tool built for that task).
      Read more below if you like.
      The three leading Voxel editing programs available appear to be Qubicle, MagicaVoxel, and VoxelShop.
      They can all save files to MV's .vox format (although getting the palette to SM block ID mapping correct would require some palette editing/creation), but none of these three is the perfect voxel software in every possible way.

      I chose to concentrate on MV for two reasons: it has the most powerful and advanced selection and manipulation functions of all three, and for the coders among us the ability to run user-written functions on the loaded model in-program.

      The weaknesses of MV are:
      - it restricts size to 126^3 (for large ships you'll have to break it into multiple templates)
      - has no native Linux build (but runs nicely with WINE or PlayOnLinux)
      - has no layers (but you can easily select complex regions based on colour and move them, or build a model from multiple sub-models in their own files)

      Also, the palette is restricted to 256 entries (I had to choose which SM blocks to leave out e.g. wedges, plants, shards, capsules, etc.). Note that you can edit the colours of the palette to whatever you like without affecting the mapping to SM block in Vox2Smtpl (.vox files record the location on the palette for each voxel as opposed to the colour itself).
      The custom editor.ui file included with Vox2Smtpl adds a narrow column to the right of the palette (A) with two-letter codes indicating what is in each row. Mousing over the codes shows a full block list for that row in the status bar at the bottom of the window (B).

      Shows modified GUI.png


      This is how the other two voxel programs compare to MV:
      Qubicle:
      - Not free: full expensive version, cheaper Steam version, and severely crippled free version.
      - Has multiple "matrices" in each model which (I think) can function as layers and mean unlimited size.
      VoxelShop
      - Has a Linux build
      - Has layers (incredibly useful - if MV had layers and a larger build size it'd be perfect)
      - textured blocks instead of plain colours (also directional?)

      Note that although it isn't really relevant, MV has an excellent built-in renderer for making beautiful voxel scenes!




      LINKS

      Vox2Smtpl:
      MagicaVoxel to StarMade Converter
      MagicaVoxel:
      MagicaVoxel - Home
      MagicaVoxel
      VoxelShop:
      VoxelShop | blackflux.com
      Qubicle:
      Qubicle Voxel Editor for Mobile Game Development, Modding, 3D-Printing
      A couple of good youtube intros to MV:
      Video1
      Video2



      Please feel free to post here any questions, problems, bugs, suggestions, or requests. Also please share your custom palette colours if you create one better than mine (it was a rush job), or any scripts you write that others might like.
       
      #1 Jojomo, Oct 13, 2017
      Last edited: Oct 16, 2017
      • Like Like x 3
      • Useful Useful x 1
      • Creative Creative x 1
    2. aceface

      Joined:
      Jun 20, 2013
      Messages:
      2,773
      suggestion: make it so that you can save as blueprint. Also I try importing this .vox but doesnt work.


      I made it with poly2vox Ken Silverman's Projects Page (scroll down a little)
       
    3. Jojomo

      Joined:
      Aug 23, 2016
      Messages:
      758
      I'll write a blueprint exporter if there's plenty of demand for it. In the mean time you can create blueprints by pasting templates onto a ship core in SM.
      I think I will go ahead and generate guide blocks that can be pasted to the core to make placing the ship around the core in the correct location easier (just a small job.)

      I don't know anything about poly2vox, but I do know that there are unfortunately many different file formats named ".vox", so I guess that one is different to MagicaVoxel's.
      To go from a 3D model of surfaces to a SM ship, I recommend using Vox2sm3. It works nicely.
      You'll also need Binvox to create the input for Vox2sm3.
       
      • Informative Informative x 1
    4. uberadiant

      Joined:
      Sep 29, 2013
      Messages:
      65
      There was an update to MagicaVoxel a few days ago that looks to have added a larger area, 1024 x 1024.

      A blueprint exporter would be great, as templates can be a pain. Although if that's a lot of work then your suggestion of a placing guide would also be useful.
       
    5. Jojomo

      Joined:
      Aug 23, 2016
      Messages:
      758
      Thanks for the info! Might try to get an update out this week...
       
    6. Jojomo

      Joined:
      Aug 23, 2016
      Messages:
      758
      I just had a look at the new MV version uberadiant, looks amazing! Not only can you put multiple models together into a 1024x1024x126 "scene" in the new World Editor (not a huge volume, but way better than 126^3 single models) but it has layers as well, and you can save the works as a single file, so won't be too much work to make Vox2Smtpl convert the whole lot to a .stmpl.

      I didn't work on it last week, but I definitely will update for this.
       
    7. uberadiant

      Joined:
      Sep 29, 2013
      Messages:
      65
      I've only played around with it a little (basically because I had no idea what I was doing) but I'll definitely sink more time into it at some point, so yeah an update would be great :)

      With any luck I'll be able to find a good way to make use of this with my Star Trek builds. Only several hundred to go :rolleyes:
       
    8. sei783

      Joined:
      Dec 27, 2017
      Messages:
      5
      Not sure if this forum gets checked but when I try to load my .vox file into VoxToSmtpl I get a "load failed" error. I can load the default objects that come with MagicaVoxel but not the custom ones.

      If it helps, all I am doing is saving a cube as a test. No modifications. The file is attached below.
      --- Updated post (merge), Jan 5, 2018, Original Post Date: Jan 5, 2018 ---
      Ok, got it to work. I was using version 99a. Version 98 is working. But now I have another issue, when I try to paste the ship in game I get "template is too large for this server" this happens no matter how small I make it. If it is a server thing then how can I change the allowable size? I did not see that in the config folder. The closest thing I see is SQL_NIO_FILE_SIZE = 256 but that's in Megabytes. My file size is just under 1 megabyte at 937 kb.
       

      Attached Files:

    9. arkahys

      Joined:
      Apr 14, 2018
      Messages:
      47
      Mod the program make it not display columns ( but work without mod). only the cube at center.
      there was a recent update, may that's the reason of bug ?
       
    Loading...