Note: this feature is only available in Voxel Play 3.
"MicroVoxels" is the term used to specify or change the shape of a single voxel (cube). By default, all Voxel Play regular voxels use a 1x1x1 cubic shape. A voxel can have microvoxels or not. By default, no voxels have microvoxels. When a voxel has microvoxels enabled, Voxel Play does not generate the default 1x1x1 cubic shape but a custom shape. This shape is constrained to the 1x1x1 cubic volume but allows you to define a more detailed aspect.
MicroVoxels only affect the shape of a single voxel. They don't carry color or texture information, so all microvoxels in the same voxel space use the same color and textures as the occupying voxel.
A slab is just half voxel filled with microvoxels. The sample character controllers support "slab mode" which just calls the proper API (MicroVoxelPlaceSlab or MicroVoxelDestroySlab) in this mode based on the crosshair.
Demo Scene
The demo scene 1 shows a few use cases for microvoxels:
- The terrain generator uses microvoxels to render half voxels. This setting can be found in the Terrain Generator associated with the world definition.
- In playmode, you can enter build mode pressing B (to have access to all inventory), press Tab to open the inventory and select any voxel and press V or M to toggle microvoxels mode or microvoxel size and place/destroy them in the terrain. These features are implemented with the provided API such as MicroVoxelDestroy / MicroVoxelPlace, etc.
- Press "H" to toggle slab mode. The slab mode overrides the microvoxel placement. You can either place a slab or a microvoxel.
MicroVoxels Layout System
The `MicroVoxelLayout` enum provides different layout modes for microvoxels:
public enum MicroVoxelLayout { Default = 0, // Standard microvoxel layout (single material for all microvoxels) Slabs = 1, // Bottom/top slab use different voxel definitions/textures TopCap = 2 // Bottom slab uses top-half texture (useful for terrain surface) }
When a microvoxels are created for any given voxel, they are assigned the default layout initially. This means all microvoxels pained in the voxel space (inside that cube) use the same voxel definition. Changing the layout to Slab let you place microvoxels using a different voxel definition on the top half. The TopCap layout is useful when rendering a half voxel but you want this half voxel to use the upper half of a texture.
General MicroVoxels address space
In Voxel Play Environment, there's a new setting called MicroVoxels Size:
This setting defines the number of microvoxels per voxel, in a similar way that the chunk size determines the number of voxels in a chunk (along any axis). By default, the MicroVoxels Size value is 16, which means each voxel can be subdivided into 16x16x16 microvoxels.
Note that MicroVoxels do not add extra memory consumption by default if they're not used. This setting just configures the address space for microvoxels (how tiny they can be).
Creating and Saving MicroVoxels
MicroVoxels can be added or removed at anytime using new API methods or the default character controllers. Any voxel that uses microvoxels will store this new data into the savegame file automatically. A new savegame file (v15) includes new additions to store the microvoxels data per chunk.
In the demo scenes, you can enable the microvoxels by pressing the V key. Then, depending on the item carried, you can remove or add microvoxels to the scene. An item can define the microVoxels property to determine the size of the tool so it determines the size of the microvoxel being placed or removed.
MicroVoxels API
New methods are available to place/remove microvoxels. Check the Scripting C# Methods page for details.
Technical Considerations
MicroVoxels add extra mesh (triangles) to the scene. The difference with custom voxel definitions is that the microvoxels produce runtime/procedural meshes which are generated natively and optimized by Voxel Play meshing algorithms and these triangles are part of the regular chunk meshes so they don't need extra drawcalls.
MicroVoxels data is stored in a packed format inside each chunk. If a voxel does not use microvoxels, there's no extra memory consumption.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article