Toilet Training with poly2vox - How to import 3D objects

Instructions for using and creating mods.
16 posts Page 1 of 2
Buffet_of_Lies
Mapper
Mapper
Posts: 402
Joined: Tue Nov 20, 2012 11:25 am


Hello again. I thought I'd do a short tutorial on how to import 3D objects into your Ace of Spades map with another Ken Silverman Windows program by the name of 'poly2vox.exe'. This program, which is a command-line program for Windows, is a very simple application which can save a lot of time for someone who is creating objects to import into Slab6 or Voxed. We'll be using both programs in conjunction with poly2vox to convert a 3D Studio model into a KVX file suitable for being imported into Voxed.

First off, you'll want to find a model to use. Creating 3D polygonal models is no easy task and falls outside of the scope of this tutorial. Luckily the internet is full of free public domain models for you to use. One resource which I have found invaluable is Archive3D. They have pretty much any common object you would encounter in daily life. For the sake of this lesson we are going to use this attractive porcelain throne.
Image

Firstly you'll want to download poly2vox and Slab6. You'll find them on Ken Silverman's page here. For the sake of clarity here are direct links to poly2vox & Slab6.

What I suggest you do is unzip Slab6 to its own folder and then unzip poly2vox into that folder. You'll be using them together quite often and it's convenient to keep them in close proximity together. For those who haven't used Slab6, it is set up a lot like Voxed and if you aren't familiar with it that's no big deal because we are going to be using it in a fairly limited manner. Mostly to resize and convert the model from KV6 to KVX.

So, having set up your Slab6 folder and added poly2vox to it, go download a model, for our example, a common toilet. It comes packaged in a ZIP file, which is fine because, conveniently, poly2vox can read objects in ZIP files. It's also convenient because often the models come with textures, which poly2vox will also attempt to process, resulting in nice colored voxel-sculpted objects. Sometimes this won't work properly and you'll get strange results. Your ship model may have a deck that is in the wrong place or the colors may be wrong. In case this happens, you'll have to get creative and either use a modeling program to fix your model or find another model. You may need to repaint or retouch the colors in Slab6. I never said this was going to be easy, did I?

So, make sure your new zipped toilet model file is in the same folder as poly2vox. Here's the tricky part, but have no fear for we'll make this as painless as possible. Poly2vox is a command-line program which means you can open a command window and use arcane DOS commands to run the program. If you were to do this you might see something like this:
Code: Select all
Microsoft Windows [Version 6.0.6002]
Copyright (c) 2006 Microsoft Corporation.  All rights reserved.

I:\Ace of Spades\poly2vox>poly2vox
POLY2VOX [input] [output] [/v#] [/s#] [/f#] [/n#] [/r#] [/m#] [/x#] [/p(file)]
by Ken Silverman (http://advsys.net/ken)  Compiled: Jul  9 2009

Converts models from polygon to voxel format.
Supported polygon formats: ASC,3DS,MD2,MD3
Supported   voxel formats: VOX,KVX,KV6,VXL (default:KV6)
Supported texture formats: PNG,JPG,TGA,GIF,CEL,PCX,BMP
POLY2VOX can load files out of a ZIP file. (Model name must match ZIP name)

 /v#  Specify voxel size of longest dimension. 1-1024, <=256 for KVX
 /s#  Specify explicit scale factor. Use this to ensure the size of all frames
      is consistent. This factor depends on the coordinate system used by the
      polygon model, so it can be anything. Run without the scale factor first
      to find a reasonble starting value to try.
 /f#  Specify frame number (MD2/MD3 only)
 /n#  Specify next frame number for interpolation (MD2/MD3 only)
 /r#  Specify interpolation ratio. Range: 0.0-1.0, default:0.0 (MD2/MD3 only)
 /m#  Specify number of mips to save: 1,5, default:5. (KVX only)
 /x   Enable an experimental xor-style converter. It's useful for
      gap-less models but has buggy color conversion
 /p(file)  Specify a pre-defined palette (Build PALETTE.DAT format: first 768
      bytes, range:0-63)

Examples:
 poly2vox bike                        (finds bike.*, writes bike.kvx, size=128)
 poly2vox bike.3ds bike.kv6 /v250   (reads bike.3ds, writes bike.kv6, size=250)
 poly2vox land land.vxl        (finds land.*, writes land.vxl, size=1024^2*256)
 poly2vox pig.md2 pig.kvx /v128 /f2 /n3 /r.5       (convert interpolated frame)
 poly2vox trooper.md2 trooper1680.kvx /s.115 /f0    (use explicit scale factor)
 poly2vox trooper.md2 trooper1680.kvx /s0.115 /f0 /ppalette.dat

As you can easily see, if you speak Wizard, poly2vox is pretty flexible for a command-line program. You could easily write some batch files with notepad (like Bildramer's Bitmap Converter uses in my other tutorial) but this really isn't necessary unless you want to do so. Luckily, poly2vox provides the ability to simply drag and drop files onto it. By doing this we can avoid having to explain anything about the Command Prompt, something I really would rather do.

That said, just throw caution to the wind and drag your zipped up toilet model onto the poly2vox program icon. A window should pop up and, after a few seconds should disappear.
Image
There should now be a new .KV6 file in the folder! Take this and drag it onto the Slab6 program icon and it should open in Slab 6.
You should now be staring at an image of a large voxelized commode, or as theGrandMaster would say, a loo.
Image

Feel free to use the , and . keys and the PageUp & PageDown keys in Slab6 to rotate and admire the fine symmetry of this object.

Image

Now, more than likely this object is far too large to fit comfortable onto a 64 voxel high AoS VXL map. It's top would be cut off abruptly. This may or may not suit your purposes for your map but assuming you want something a bit more suitable for "dropping a deuce" into you'll need to resize it. Slab6 can do this easily by selecting Tools > Halve dimensions.
Image
Which should result in a smaller object.
Image
This will still be pretty large on the map. You can keep halving the dimensions until you achieve the desired size.

So now I just want to take a moment to mention something about Slab6 that I am not positive everybody using the program is aware of, the Slice Editor. This is one of the most powerful tools within Slab6. Hit the Enter key and you should see the Slice Editor appear.
Image
As you can see, in the lower right hand corner of the program window, you'll see a cross-section of your object in the X, Y & Z axes. You can resize these axis windows by hovering over them with the mouse and using the / and * keys. PageUp & PageDown will change the active "slice" you are looking at. You can also edit within these windows by adding voxels or copying and pasting portions with the SHIFT key and dragging with the mouse to select a region and then pasting them elsewhere with the SHIFT-Insert key. I only mention this because in the slice editor you'll notice that some interior portions of the model appear in black while other portions appear to be grey or empty. In this case the water tank appears black which indicates that it is not hollow. If you wanted to you could carefully hollow this out. I'm not going to go into much more detail on this and am going to leave it to you to explore more deeply. It can take some practice to get used to. I also highly suggest reading (and maybe even printing out a hard copy of) the slab6.txt help file because there are many more useful slice editor functions to explore.

On with the tutorial! So now we will want to re-save our resized thunderbox into a format appropriate for importing into our map in Voxed. Choose File > Save As and save it with the filename of your choice BUT be sure to save it as a KVX file this time. This is necessary because of the way Voxed imports objects. It will import a KV6 model quite happily, and let you place it on the map, but when you save that map and reload it, your object will, sadly, not be there. (Why is this, you may ask. It has something to do with KV6 being a sprite object or something like that. There are ways around it, involving placing a single "placeholder" block on the map before you import the KV6 but after you actually place it your object will suddenly have it's resolution quartered and it will look really ugly. So just take my word for it and convert it to KVX. I would never lie to you, would I?)

So now you've saved your KVX file and you're ready to import this fine chamber pot into a map in Voxed. I'll be using my greengrassy.vxl map from my other tutorial on Heightmapping. Open up Voxed and load up your map. (Pro Tip: you can just drag and drop a VXL map onto Voxed.exe and it will open that map!)

Now for the magic moment when we import the object onto the map. You'll want to point the tiny voxed crosshair at the block point you want to place your object. Being unimaginative and lazy, I just looked straight down at the center of the map.
Image

Now, simply hit the 'U' key on your keyboard and navigate to the folder you saved your object in. I copied my object over into my voxed folder earlier. Select your object and click Open.
Image

Voilà! Il est aux toilettes très grand!
Image

So now that you've succesful'y placed a large toilet in the middle of your map you'll probably want to make sure it's properly positioned. This is especially true if you happened to have place it on uneven terrain. You don't want your object to appear to be balanced precariously on a single block. So ease it slowly down using the Enter key on your NumPad until it makes firm contact the ground in a manner that looks good to you.
Image
Impressive, no? You could lose a whole team of deuces in there.

So, if you need to move it around you'll use the NumPad again and just for the the record, and because Ken Silverman, in his wisdom, didn't seem to bother to include this in the direction text file, I'll outline what the numpad keys do. Okay I lied. Ken does mention them in his documentation that nobody reads. But it's in no particular order because that's just the way Ken rolls.

Object movement options:
Enter= moves object UP
4= moves object DOWN
1= moves object to the LEFT (relative to which way you are facing)
3= moves object to the RIGHT (relative to which way you are facing)
5= moves object FORWARD/AWAY from you (relative to which way you are facing)
2= moves object BACK/TOWARDS you (relative to which way you are facing)
8= flips the object front to back
7= flips the object side to side
9= flips the object upside down

Other miscellaneous numpad options:
/ and * zoom view in and out
. changes the voxel shading
0 key moves your camera DOWN (as opposed to the CTRL key which moves the camera UP)

(Keep in mind if you add another object or basically do anything else in Voxed you'll lose focus on the object and it will become a fixed part of the map at that point.)

Now you'll want to save your map. You do this by hitting ALT+F3. Choose a filename and hit Save.

Our tutorial is at it's conclusion. I hope this has helped explain both how to import an object into Voxed and how to use Voxed a little better. I left out a lot of stuff such as how to paint in Slab6 and edit your objects, but a that is sort of outside of the scope of this tutorial. One thing I might add, though, for those of you who have a tough time with Voxed is a mention of the app Voxed_Companion. Created by a user known only as Grapist, I've found this tool to be invaluable in making Ken Silverman's counter-intuitive keyboard layout a bit more user-friendly. It can be found on Izzy's aloha.pk forum here. All it really does is rebind the keys a bit differently, letting you use the mouse (no longer inverted!) with the standard WASD keys to move around. Be forewarned some of the standard Voxed commands are now overwritten by the new key bindings but you can turn it off temporarily in the system tray. It also now will minimize Voxed by tapping the Escape key briefly. Hold the Escape key to shut down the program.

Oh, yeah, and if you want it, here's the toilet model I used as an example in the tutorial. Feel free to do whatever you like in it... er, I mean, with it.

Hope you've enjoyed our little exercise. Feel free to ask any questions or nitpick any details I screwed up. Till next time. Blue_Happy1 Green_BigSmile Blue_Happy3 Green_Sunglasses1
FaultCheck
Coder
Coder
Posts: 171
Joined: Sun Nov 11, 2012 7:02 pm


Very informitive and detailed walkthrough, did not know about the slice editor, that is sick, did not relize it was that easy to convert poly to vox, that is sick... did not know you could drag and drop on to voxed, nice tip too... Blue_Sunglasses1 5/5 Stars! Green_Sunglasses1
Buffet_of_Lies
Mapper
Mapper
Posts: 402
Joined: Tue Nov 20, 2012 11:25 am


I thought I'd throw in another site that has some 3DS models that people might find interesting and useful to convert with poly2vox. That site would be Sci-Fi 3D. While not all of the resources on there are suitable for use in poly2vox, I would direct your attention to the Star Wars Craft & Vessels section. Specifically the Imperial Navy section has some really cool 3DS models I've fooled around with in the past. The AT-AT looks particularly cool as a KVX model as do the Star Destroyer models.
Image
Not to mention the Jawa Sandcrawler.
Image
You can see how the texture maps translated nicely in poly2vox and, although you can't see it here, you can crawl around inside the interior! (Download both models in the links above the image and see!)

Sadly, scale can be a big issue with these but I am sure someone will come up with something imaginative. On that note, for those who remember Serious_Sim and my attempt to make a Titanic map for Ace of Spades, scale can very much be an issue. If you try to import an object that is too large into Voxed the program will simply not allow it and maybe crash. I am not sure what the upper limit on model size is, to be honest. I suspect it's something in the neighborhood of 256 voxels. For that you'll have to cut it down to a reasonable size and import it as two separate halves, which is what I had to do to get the Titanic model in there.

In the near future I'll be doing a tutorial on using Voxed itself. Possibly it may be a several part tutorial covering different aspects but I am not totally sure. One thing I'll cover, though, is EXPORTING objects from Voxed and back into Slab6. Yes, it is a little known function of Voxed that it can export objects. The documentation is pretty vague about but it is reasonably simple to do with proper preparation.
Jdrew
Mapper
Mapper
Posts: 4808
Joined: Tue Oct 30, 2012 10:48 pm


So basically we can have a death star in game?
Buffet_of_Lies
Mapper
Mapper
Posts: 402
Joined: Tue Nov 20, 2012 11:25 am


jdrew wrote:
So basically we can have a death star in game?
I don't see why not.
Yourself
Coder
Coder
Posts: 28
Joined: Mon Nov 05, 2012 5:24 pm


Also note that there is a size limit to the models poly2vox can export. I believe Dany0 compiled a modified version of poly2vox which can handle large data. It was posted under the name "poly2vox unlimited". I don't know where the download link is anymore.
Buffet_of_Lies
Mapper
Mapper
Posts: 402
Joined: Tue Nov 20, 2012 11:25 am


Yourself wrote:
Also note that there is a size limit to the models poly2vox can export. I believe Dany0 compiled a modified version of poly2vox which can handle large data. It was posted under the name "poly2vox unlimited". I don't know where the download link is anymore.
Noted: the size limit is 256X256X256 for KVX file output. It's 1024 for others... I assume that wouldn't apply to KV6 files which is the default output. As for Dany0's version of poly2vox, I do recall that but I can't find a download link so I am not really going to go beyond agreeing that it may or may not have existed once.

Whatever happened to Dany0, anyways?
Jdrew
Mapper
Mapper
Posts: 4808
Joined: Tue Oct 30, 2012 10:48 pm


Dany0 left a few weeks before Jagex closed the forums, he said he had stuff in life to do or something
TB_
Post Demon
Post Demon
Posts: 998
Joined: Tue Nov 20, 2012 6:59 pm


I never really understand the point in leaving because of real life being busy.
You always have time to occasionally pop into the IRC.

Anyway, I shouldn't derail this too much.
This looks really interesting buffet, you've made some really well written threads lately.
Keep it up. :)
Buffet_of_Lies
Mapper
Mapper
Posts: 402
Joined: Tue Nov 20, 2012 11:25 am


Just thought I'd throw this out there. Some of you may have noticed in one of the videos made for the frontpage of this website has a Godzilla model. The video was made by (I think) LastofS and the model was a conversion by me. The website I got the model from was the Scifi site I listed above but shortly after I made this they were pulled, probably due to copyright issues or something.

So here he is. Godzilla, or as I like to call him, Brozilla! The perfect addition to any city map.
(I'm pretty certain he even has a stomach and intestinal tract inside.)

Image
KVX model download link

Enjoy!
Liwo
Deuce
Posts: 2
Joined: Wed Feb 27, 2013 4:22 pm


Doesn't work on Win 8.
learn_more
Coder
Coder
Posts: 890
Joined: Sun Mar 24, 2013 9:59 pm


Liwo wrote:
Doesn't work on Win 8.
you win the price for useless post of the day.

why doesnt it work, how doesnt it work,...
Buffet_of_Lies
Mapper
Mapper
Posts: 402
Joined: Tue Nov 20, 2012 11:25 am


Liwo wrote:
Doesn't work on Win 8.
Huh? What doesn't work?
Liwo
Deuce
Posts: 2
Joined: Wed Feb 27, 2013 4:22 pm


Buffet_of_Lies wrote:
Liwo wrote:
Doesn't work on Win 8.
Huh? What doesn't work?

Oh, sorry. Poly2vox doesn't work on Win 8.
Buffet_of_Lies
Mapper
Mapper
Posts: 402
Joined: Tue Nov 20, 2012 11:25 am


Liwo wrote:
Buffet_of_Lies wrote:
Liwo wrote:
Doesn't work on Win 8.
Huh? What doesn't work?

Oh, sorry. Poly2vox doesn't work on Win 8.
Well there's not a whole hell of a lot I can do about that. You could perhaps try running the program in compatibility mode or try using DOSBox.
16 posts Page 1 of 2
Return to “Guides / Tutorials”

Who is online

Users browsing this forum: No registered users and 1 guest