Minimum requirement: Qubicle Basic Edition + Mesh Module DLC
With Export Cubes you can export all voxels of a selected object as individual cubes stored in an FBX file. Most of the time the optimized meshes exported by Export As FBX etc. are preferable, because they have much less geometry and render a lot faster. But for special uses like physics simulations you may need the individual cubes. For an example, see the image below. The voxels of the robot's head are exported as cubes, so we can explode them later!
Before exporting an object, decide whether you need the core voxels or not. Core voxels are the ones that are completely surrounded by other voxels and therefore not visible (if all voxels remain in their original place). If you don't need the core voxels, remove them with Modify > Core/Hull > Hollow. This way you will save a lot of geometry.
How to export
- Select the object you want to export.
- Choose File > Export > Cubes.
- Adjust export settings.
- Select a filename and destination.
The settings are similar to the regular mesh export settings. This enables you to easily mix both export methods.
Voxel Size (Units)
Specifies the size of a single voxel in units. Default is 1:1:1, which means a voxel is 1 unit wide, high and deep. You can change that for all 3 axes. Values given here are multiplied to all vertex positions and also the object's position and pivot.
Unit Scale Factor
It tells the importing tool how the default unit size should be scaled. E.g. a default unit in FBX is 1m. If you set it to 0.01 then a unit is 1cm. Unfortunately different tools interpret this value in different ways (or ignore it completely). Changing this values does not have any effect on the exported vertex positions, it's more like a global setting for the file. If you want to scale vertex positions use the Voxel Size setting instead.
- Use Texture to store color information in a separate .png file. Texture generation is affected by Texel Size and Edge Bleed. A simple texture is created with a single square for each unique color that is used in the model.
- Vertex Color requires a vertex color shader in order to display the colors.
Defines how many pixels are used for a voxel face on the texture. In most cases 1 is a sufficient size.
Adds an outline to the texels and determines its size. This is important to avoid render issues that occur due to interpolation made by the GPU. Higher values might be needed if an object is far away from the camera.
Allows you to specify a subfolder for the texture output relative to the export folder. If you leave this value blank then textures are stored in the same folder as mesh files. Default is set to "materials" because Unity automatically creates this folder on import.