3D model importing guide: Faster, Better, (Stronger?)

    Discussion in 'Third Party Software' started by spacie, Sep 11, 2015.

    1. spacie

      Joined:
      Jul 2, 2013
      Messages:
      47
      3D model importing has been a known and used feature of SMedit for quite a while now.
      In the past there were two ways of going about this: directly put an .obj file into SMedit or convert the .obj to .binvox first.
      This guide describes a third alternative, which is far more accurate than SMedit's own polygon to block converter and orders of magnitude faster than the binvox route (once properly set up).
      Let me first introduce a sample of converted ships: all the battlecruisers from EVE online, approximately 1:1.



      You can download all 12 of the shells as a sample pack here: link
      All symmetrical ships have been mirrored as well.

      Now, onto the main point: What is this new method? Basically it's the conversion of a 3D model into a voxel/block format with something called poly2vox, converting the resulting file into a minecraft schematic with kv6ToSchematic, importing that into SMedit and saving it as a starmade blueprint.

      Now why would you go through all that trouble? Let's see by comparing it to the two existing alternatives:
      [​IMG]

      So, the main advantages are better quality than SMedit alone, consistent 1 block hull thickness, much quicker than binvox, support for more formats and support for texture to block colour mapping
      The main disadvantage being the 256 height limit, which gets in the way of making really big things. For tall, thin ships you can get around this by rotating the model on its side in something like blender. Then again, most starmade ships fit into these box dimensions.

      "That sounds great! I want to use this!"
      Perfect! Let's get started then!
      You'll need a couple of things:
      Poly2Vox: Where the magic happens (download halfway down the page)
      KV6toSchematic: A modified version. The standard version has a size limit of only 512x512x256 (and can be found here)
      SMedit: It's outdated and slow, but you ain't got no choice, son.

      Below you can find a detailed instruction on how to perform each step of the process.

      Poly2vox Setup and Use
      When you have downloaded the zip file from the site above, you'll want to extract poly2vox.exe from the file with 7zip, winrar or any other acrchiver. Unfortunately this is a command line program, meaning it doesn't have a user interface and just clicking it won't do anything.
      You'll have to start by opening a command prompt (cmd.exe) and navigating to the directory where you put it by entering
      Code (Text):
      cd <directory>
      or
      Code (Text):
      cd /d <directory>
      if you saved it on a different drive than your OS is on.
      if you now enter poly2vox in the command prompt, you should get a detailed description of all the parameters you can use here. For now we'll only be using the /v# parameter. This specifies the largest dimension of the resulting block/voxel model, which makes scaling ships quite easy.
      Keep in mind that doubling the scaling factor will increase the conversion time by roughly a factor 8, (triple means waiting 27 times longer, etc.) so be careful what you put there.

      Now is the time to find a nice 3d model and start converting it. I am using EVE-hurricane.stl as an example.
      For ease of use, put it in the same folder as poly2vox.exe . And run the following command
      Code (Text):
       poly2vox <filename> /v<largest dimensiom in blocks>
      example:
      poly2vox EVE-Hurricane.stl /v490
      Running this will output the following:
      [​IMG]
      Here you can see the dimensions, scale factor, and the time it took to convert.

      You now have a .kv6 file with voxel data! On to the next part!

      KV6toSchematic use
      This is actually the easiest part of the process, because this is a simple java program with an actual GUI.
      Put kv6toschematic.jar in the same folder as poly2vox.exe for ease of use and just double click on the .jar.
      For the best results select "Use default palette", "use wool blocks" and then simply select the file you want to convert. In this example, that would be EVE-Hurricane.kv6, click open, wait for the conversion to finish and then simply save the schematic at a location of your choosing.

      Et voilá! That's the second step done.

      SMedit setup and use
      I'll only be going over setup and basic operations needed to get your ship into SMedit and to starmade, things like mirroring fall outside of this guide and are also covered by other tutorials out there.

      The download link on the wikipage above gets you SMedit.jar. You can run this from any folder as long as you've set the starmade path in the launcher correctly. If you've installed starmade without steam you should know your install folder. If you are using steam you can go there by right-clicking on starmade in your library, clicking properties, going to the LOCAL FILES tab and clicking BROWSE LOCAL FILES.

      When you first launch SMedit.jar you'll want to put the directory/path in the launcher. This should end in ../StarMade/StarMade for SMedit to function.
      I also recommend 2 GB of RAM or more for larger operations (ships longer than 500 blocks or so)
      Be sure to click apply so your settings are saved.
      When you launch SMedit, it's quite likely that all the colour options are grey. This is normal and shouldn't matter for importing schematics (just inconvenient). You will also be looking at a standard ship from the front. It's useful to know where the axes of your ship are so click view->Axis to show them.
      The z-axis will be toward you (bright blue) (you're looking at the front of a ship), the x-axis will be to the right (bright red), the y-axis will point upward (bright green).

      We start by going to file->import->schematic and selecting the schematic you made earlier.
      The imported schematic may be facing the wrong way. You can fix this with modify->rotate.
      Pitch rotates the nose of your ship downwards, yaw rotates the front of your ship to the left (when aligned with the ship core) and roll rotates the ship clockwise along its length (anticlockwise if looking at it from the standard SMedit view, which is from the front.)
      (rotations follow the right hand rule, if that's easier to remember for you)

      Once you have your ship rotated you might want to relocate the core, since smedit puts it in the exact center of the ship and some ships have holes there. Or you might just want the core in a different location.
      The core is located at the interesction of the three axes and can be moved with modify->move where you can specify how far along each axis you want the the core to be moved.

      If you're all content with core location and the direction of the ship, you can save it as a blueprint by going to File->Save As->Blueprint.

      You should now be able to load the blueprint from inside the game.

      As small suggestion, if you want to look at the model from a different angle you can do so by clicking and dragging with the left mouse button. It can be quite a laggy thing to do, so you may want to turn off rendering for the ship entirely while you're moving about by clicking View->"Don't draw".

      After doing this a few times, the human parts of the process are actually quite quick and the conversion parts are even quicker.
      For those who made it to the bottom of this post, and don't think they'll be able to get this to work, I'll help you out: reply with a link to a model you want to use, specify the maximum dimension and I'll convert it for you. Limit 1 per person for now. More if there's not much demand.

      If anything isn't clear, please don't hesitate to ask.
       
      • Like Like x 6
      • Informative Informative x 4
    2. Thadius Faran

      Thadius Faran #1 Top Forum Poster & Raiben Jackpot Winner

      Joined:
      Oct 13, 2013
      Messages:
      5,049
      Sweet now if only the SMEdit converter by itself were updated we would have a true new method.
       
    3. papachabre

      Joined:
      Aug 21, 2015
      Messages:
      34
      Cool! I work in SolidWorks for my job and I have access to it in my free time too. Maybe I'll try designing a ship there and importing it into StarMade.
       
    4. Xtremesonicboom

      Joined:
      Sep 12, 2014
      Messages:
      90
      You, sir, are a lifesaver. SMEdit's .obj importer quit working on me, and I had a backlog of ships I wanted to convert. Thanks to your method, I can start working on a dozen things at once again.
       
    5. Dellexe

      Joined:
      Aug 10, 2015
      Messages:
      99
      So is there any way around the 256 max height? Does the modified version allow for taller builds?
      -
      The things I want to SMEdit are pretty big. 700x700 Ha'Tak, 600~ long BC-304, and things of that size and up.
       
    6. spacie

      Joined:
      Jul 2, 2013
      Messages:
      47
      700x700 hatak you probably want to use binvox for. The result is nearly the same, just takes a lot longer. 600 long BC-304 should probably fit. If you wanna go further up (larger than 1024 high), you'll either have to find a way to use binvox on linux, write your own script to convert kv6 files to schematics or just use SMedit's own conversion.

      You can sortof go over the 256 height, but the model will then actually start to wrap around (it starts from the top, when it reaches 0 and there's still stuff left, it will start at the top again. You can see that here: like this which was supposed to be the 1:1 scale version of this) Because schematics apparently can only store 8 bit height data.

      There's also the less appealing option of chopping up your ship in a 3d modelling program, converting the chunks, then stitching em back together in starmade/smedit. Choose whichever option you think is best/least time consuming in total. (with just smedit you'll have to do a lot more hull adjustments)
       
      • Like Like x 1
    7. KillaKrazy

      Joined:
      Feb 16, 2014
      Messages:
      256
      Where do you find your models at?
       
    8. VoidrayX

      Joined:
      Jun 24, 2013
      Messages:
      41
      Hey im having some troubles in exporting my textures with the model in 3ds, any tips on how I can do that?
       
      #8 VoidrayX, Sep 12, 2015
      Last edited: Sep 12, 2015
    9. Dellexe

      Joined:
      Aug 10, 2015
      Messages:
      99
      -
      Google.
      -
      My Stargate models (which are of fantastic quality, by the way) came from a mod for Homeworld 2 called Stargate: Space Conflict. The creator of the mod modeled a ton of Stargate ships, and even created some of his own ships that fit into the Stargate universe really well. The mod is also as high of quality as the models, I recommend people who have Homeworld 2 to check it out.
      -
      It's kinda annoying to get the actual files, though. I had to download some modding tools and extractor tools to pull the files out.
       
    10. Thadius Faran

      Thadius Faran #1 Top Forum Poster & Raiben Jackpot Winner

      Joined:
      Oct 13, 2013
      Messages:
      5,049
      Gonna make the BC-305 Achilles class?
       
    11. spacie

      Joined:
      Jul 2, 2013
      Messages:
      47
      Some more information would be helpful, like what are you trying to do and what isn't working as you thought it would?
       
    12. VoidrayX

      Joined:
      Jun 24, 2013
      Messages:
      41
      Im exporting as obj, have also selected to export maps, however when I open to obj the textures are not there just the mesh. I have then tried to use .3ds but the same happens. This ends up in having no colour in the imported blueprint. Hope you can help me. Thanks!
       
    13. VoidrayX

      Joined:
      Jun 24, 2013
      Messages:
      41
      I went to try specifying the .dds diffuse file in the kv6 conversion process but nothing came out either, no colors nothing
       
    14. spacie

      Joined:
      Jul 2, 2013
      Messages:
      47
      For .obj with textures you need the .obj file, and the associated .mtl file for the textures (which should be detected automatically). A .dds file shouldn't make a difference. As for 3ds, I tried one of those myself once, which did actually apply the textures to block colours fine. Do you have the model available so I can give it a try perhaps?
       
    15. Zenaris

      Joined:
      Jul 28, 2015
      Messages:
      4
      I got till the point where it created the Kv6 File but if i open the kv6 in in Converter i can choose the file and click open but then the program closes and nothing happens :/ maybe its because i am on windows 10?
       
    16. Rixxan

      Joined:
      Nov 16, 2014
      Messages:
      450
      Thank you so much! This'll allow me to use SMedit again, if only someone knew the project well enough to give it a basic rudimentary update, even if it only adds a little.
       
    17. plusnine

      Joined:
      Jun 30, 2013
      Messages:
      175
      fantastic post. have used this for two large projects and it's been a lot less work than cleaning off smedit knobby-jobs!
       
    18. Zenaris

      Joined:
      Jul 28, 2015
      Messages:
      4
      I tried the whole day to get this to work :/ seems i have no chance at all... or maybe I am just to stupid :p
      You offered in your mainpost that you would convert a model if I have one. Well I am a really big fan of homeworld and found a source of nearly all models and textures, but sadly they are not in *.obj, they are in *.wrl.

      http://www.homeworldaccess.net/shipstats/units9a9a.html?action=show&ship=4776 I really love the Design of this one here, would be really cool if you can convert it for me.
      If you can please place the core behind the hangar bays so that its not in the way for ships that are flying in.
      The downloadbutton is rather small it is placed above the "Weapons" heading.

      maybe you find some ships on this site that are to your liking too :)

      EDIT: oh i forgot the size :p from the front to the rear it should be 800. Thats the Longest axis.
      EDIT 2: Looks like there is no button to go to all ship models so i place the link for it here so you can see all models and maybe you like one for your own creations^^ http://www.homeworldaccess.net/shipstats/units.html

      Greets
      Zenaris
       
      #18 Zenaris, Sep 13, 2015
      Last edited: Sep 13, 2015
    19. VoidrayX

      Joined:
      Jun 24, 2013
      Messages:
      41
      Here you go, if you get it to work could you leave the steps for me please. Longest dimension should be 250 btw

      Thanks alot!
       
      #19 VoidrayX, Sep 14, 2015
      Last edited: Sep 14, 2015
    20. spacie

      Joined:
      Jul 2, 2013
      Messages:
      47
      The Vaygr Mothership: download

      [​IMG]


      I'm afraid I can't get it to work here either. Textures are definitely there, just don't seem to be linked to the model, which is where my knowledge of 3d model texturing ends. (where did you get that starcraft model from?)
      Just adding the block colours after conversion is probably gonna be less time intensive in this case, 250 long is still reasonable.
       
      • Like Like x 1
    Loading...