It is currently Mon Dec 09, 2019 7:28 pm


All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: ProcessVDB
PostPosted: Sun Oct 25, 2015 3:07 pm 

Joined: Sun Oct 25, 2015 1:36 am
Posts: 2
I would first like to commend the authors of Cubiquity for Unity3D. It is a nice extension that works well out of the box for my purposes. After testing the examples and reading through the documentation, my next step was to create a colored cube volume using some of the mentioned third party utilities in the manual.

Quote:
"You may wish to model your voxel geometry in an external application such as Magica Voxel, Voxel Shop, or Qubicle Constructor."


Voxel Shop is very nice, easy to use and free.
Magica Voxel editing is similar to Voxel Shop, but the file handling is clunky and confusing.
Qubicle Constructor costs $150 for commercial use, so I haven't had the opportunity to test it out.

The next part of the user manual talks about using ProcessVDB to convert the save files from above mentioned utilities so they can be used with Cubiquity's ColoredCubeVolumeData. However, there is no comprehensive guide to the commandline options available to ProcessVDB

If I type:

Code:
ProcessVDB.exe -help

I get this:
Code:
Please see the Cubiquity user manual for options and examples.


The reason I am bringing this up is because I am having a hardtime producing a file that can be used by Unity3D's Colored Cubes Volume game object. I started with VoxelShop because it was the easiest to use. The latest version of VoxelShop has 2 export options, Vox Game Format (*.vox) and VoxLap (*.vox), that seem to match the options for ProcessVDB. I created a simple colored cube 64x64x8 in size, exported in both formats and tried to use ProcessVDB to convert them into volume database for the ColoredCubeVolume. If I try to use the -magicavoxel commandline option on the Vox Game Format file, I get this output:

Code:
>ProcessVDB -import -magicavoxel smallertest.vox -coloredcubes output.vdb

[10:32:27, INFO ]: Importing voxel database...
[10:32:27, INFO ]: Importing from Magica Voxel...
[10:32:27, INFO ]: Importing MagicaVoxel from 'smallertest.vox' and into 'output.vdb'
[Error] MV_VoxelModel :: magic number does not match
[10:32:27, ERROR]: Failed to load Magica Voxel file.
[10:32:27, ERROR]: Unhandled exception:
[10:32:27, ERROR]:      Failed to load Magica Voxel file.


When I try to use the -vxl commandline option on the Vox Game Format file, I get this output:

Code:
>ProcessVDB -import -vxl smallertest.vox -coloredcubes output.vdb

[10:36:49, INFO ]: Importing voxel database...
[10:36:49, INFO ]: Importing from VXL...
Importing vxl from 'smallertest.vox' and into 'output.vdb'[Info   ]: Creating empty voxel database as 'output.vdb'
[Error  ]: Attempted to write to a voxel which is outside of the volume
[Error  ]: Caught 'invalid_argument' at C interface. Message reads: "Attempted to write to a voxel which is outside of the volume"
[10:36:49, ERROR]: Attempted to write to a voxel which is outside of the volume
[10:36:49, ERROR]: An error occured inside the Cubiquity library:
[10:36:49, ERROR]:      Error code: 120 (CU_INVALID_ARGUMENT)
[10:36:49, ERROR]:      Error message: Attempted to write to a voxel which is outside of the volume


I then attempted to use ProcessVDB on the VoxLap export using the -vxl commandline option

Code:
>ProcessVDB -import -vxl smallertest2.vox -coloredcubes output.vdb

[10:41:38, INFO ]: Importing voxel database...
[10:41:38, INFO ]: Importing from VXL...
Importing vxl from 'smallertest2.vox' and into 'output.vdb'[Info   ]: Creating empty voxel database as 'output.vdb'
[Error  ]: Attempted to write to a voxel which is outside of the volume
[Error  ]: Caught 'invalid_argument' at C interface. Message reads: "Attempted to write to a voxel which is outside of the volume"
[10:41:38, ERROR]: Attempted to write to a voxel which is outside of the volume
[10:41:38, ERROR]: An error occured inside the Cubiquity library:
[10:41:38, ERROR]:      Error code: 120 (CU_INVALID_ARGUMENT)
[10:41:38, ERROR]:      Error message: Attempted to write to a voxel which is outside of the volume


Unsure what I was doing wrong, I decided to move over to MagicaVoxel and attempt to convert one of the example files that came with MagicaVoxel. Using the castle.vox example found the vox folder of MagicaVoxel, I ran it through ProcessVDB

Code:
>ProcessVDB -import -magicavoxel castle.vox -coloredcubes output.vdb

[10:45:32, INFO ]: Importing voxel database...
[10:45:32, INFO ]: Deleted previous file called "output.vdb"
[10:45:32, INFO ]: Importing from Magica Voxel...
[10:45:32, INFO ]: Importing MagicaVoxel from 'castle.vox' and into 'output.vdb'
[Log] MV_VoxelModel :: Chunk : MAIN : 0 10552
[Log] MV_VoxelModel :: Chunk : SIZE : 12 0
[Log] MV_VoxelModel :: Chunk : XYZI : 10516 0
[Log] MV_VoxelModel :: Model : 21 21 21 : 2628
[Info   ]: Creating empty voxel database as 'output.vdb'
[Info   ]: Resizing compressed data buffer to 144307bytes. This should only happen once
[10:45:32, INFO ]: Exiting normally.


So far so good, I moved the output.vdb in the Assets\StreamingAssets\Cubiquity\VoxelDatabases folder, fired up Unity3D, loaded the EmptySceneWithLighting scene and added a new Colored Cubes Volume. Using the project explorer in unity, I right-clicked on the newly found output.vdb file and chose Create -> Colored Cubes Volume Data -> From Voxel Database... Then I selected the new file (output.vdb). A new file output.asset was created. Following the user manual I tried to have my Colored Cubes Volume use this new asset file.

Quote:
Return to edit mode, and again select the colored cubes volume, go to 'Settings' in the inspector, and click the small circle next to the 'Volume Data' field.


However, when I click the small circle, there is no option with the name 'output'. Therefore preventing me from being able to use my newly created volume data.

In conclusion, MagicaVoxel was the closest I got to creating a usable Volume database, but I can't seem to find away to select the generated database using unity. I was hoping someone could fill me in on what I am missing. Any help would be greatly appreciated.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: ProcessVDB
PostPosted: Mon Oct 26, 2015 8:18 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Thanks for the very thorough explanation - I can see why you would be confused!

kohansey wrote:
Voxel Shop is very nice, easy to use and free.
Magica Voxel editing is similar to Voxel Shop, but the file handling is clunky and confusing.
Qubicle Constructor costs $150 for commercial use, so I haven't had the opportunity to test it out.

The next part of the user manual talks about using ProcessVDB to convert the save files from above mentioned utilities so they can be used with Cubiquity's ColoredCubeVolumeData.


Right, so it's already a little misleading. The only one of these which is supported directly is the MagicaVoxel's native '.vox' format, but I mentioned the others because the applications support each others formats (to some degree...?) allowing you to move between them.

The supported '.vxl' format is specifically for maps from the game 'Build and Shoot'. I don't think I've tested other '.vxl' files and there is probably an assumption that they are 512x64x512 voxels large.

Furthermore, I don't think '.vox' and '.vxl' are standard formats - they are common extensions which may be used by different formats. So it's quite hard to know what they mean.

Overall, working with MagicaVoxel and it's native format is the best approach (as you found).

kohansey wrote:
Quote:
Return to edit mode, and again select the colored cubes volume, go to 'Settings' in the inspector, and click the small circle next to the 'Volume Data' field.


However, when I click the small circle, there is no option with the name 'output'. Therefore preventing me from being able to use my newly created volume data.


Very strange! So you don't see 'output', but do you see any options listed? The example 'VoxeliensColoredCubes' or 'ImportedCity'? Perhaps try placing your 'output' files next to the VoxelienColoredCubes one (in ...\Assets\Cubiquity\Examples\Basic)? Or even deleting one of the examples and renaming/placing your own files in their place to see if they load?


Top
Offline Profile  
Reply with quote  
 Post subject: Re: ProcessVDB
PostPosted: Tue Oct 27, 2015 11:49 pm 

Joined: Sun Oct 25, 2015 1:36 am
Posts: 2
Hello David,

Thank you for getting back to me. I tried your suggestion, but it didn't seem to make a difference. I decided to look into it farther by opening the output.asset file in a text editor. This file was generated from the right click menu Create -> Colored Cubes Volume Data -> From Voxel Database... The data in the file looked to be a copy / paste of the data in the output.vdb (aka Hexadecimal format). However, if I open up one of the asset files that show up in the list, I see something like this
Code:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
  m_ObjectHideFlags: 0
  m_PrefabParentObject: {fileID: 0}
  m_PrefabInternal: {fileID: 0}
  m_GameObject: {fileID: 0}
  m_Enabled: 1
  m_EditorHideFlags: 0
  m_Script: {fileID: 11500000, guid: cb5f88e7471b13f45ada3ae20cb9f09d, type: 3}
  m_Name: VoxeliensColoredCubes
  m_EditorClassIdentifier:
  basePath: 0
  relativePathToVoxelDatabase: Examples/VoxeliensColoredCubes.vdb
  mWritePermissions: 0


Using a text editor, I modified the output.asset file to match the format from VoxeliensColoredCubes.asset, changing relativePathToVoxelDatabase to match my path in the SteamingAssets folder and modified m_Name to 'output'. After saving the file, I could now see 'output' in the list of assets. When I selected 'output', the colored cube volume matched the castle from MagicaVoxel. It would appear there is something wrong with the
Code:
CreateColoredCubesVolumeDataAssetFromVoxelDatabase
MainMenuEntries script. I am using Unity3D version 5.2.0f3 Pro Edition.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: ProcessVDB
PostPosted: Thu Oct 29, 2015 11:05 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
kohansey wrote:
It would appear there is something wrong with the
Code:
CreateColoredCubesVolumeDataAssetFromVoxelDatabase
MainMenuEntries script. I am using Unity3D version 5.2.0f3 Pro Edition.


Well this is very strange! It seems to work on for me (Unity 5.2.1f1, Windows 10 64-bit). To test I went to:

Code:
Assets\StreamingAssets\Cubiquity\VoxelDatabases\Examples


Copied ImportedCity.vdb and renamed it to TestDatabase.vdb. The I ran Unity and used right-click Create -> Colored Cubes Volume Data -> From Voxel Database... to create TestDatabase.asset which looks as follows:

Code:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
  m_ObjectHideFlags: 0
  m_PrefabParentObject: {fileID: 0}
  m_PrefabInternal: {fileID: 0}
  m_GameObject: {fileID: 0}
  m_Enabled: 1
  m_EditorHideFlags: 0
  m_Script: {fileID: 11500000, guid: cb5f88e7471b13f45ada3ae20cb9f09d, type: 3}
  m_Name: TestDatabase
  m_EditorClassIdentifier:
  basePath: 0
  relativePathToVoxelDatabase: Examples/TestDatabase.vdb
  mWritePermissions: 0


I'm afraid I really don't know why it isn't working for you!


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net