PicaVoxel

The Tiny Voxel Toolset for Unity

PicaVoxel is an easy-to-use voxel editing toolset that allows you to create and manipulate vertex-colored voxel models directly inside the Unity editor.

It is also a mini game engine that allows you to use the voxel data in your scene at runtime. Generate and explode voxels! Animate your voxel models using simple frame-based animation - just like creating a 2D spritesheet, but in 3D!

You can import voxel models from MagicaVoxel and Qubicle, the two most popular voxel modelling tools.

PicaVoxel includes five sample games to help you get the most from the toolset.

PicaVoxel came about during development of my current game Jarheads. One of the most asked questions during development streams is “Will you be releasing the engine?”. For a long time, the answer was “Yes, but not until after I’m done with the game!”. Then, over the holidays, I started thinking about it and became quite excited by the prospect of making a user-friendly version of the engine. Something that could integrate with Unity and help others make games that are similar in look and feel to Jarheads, Crossy Road and Voxatron.

And so PicaVoxel was born. It’s a non-linear voxel toolset - you create individual voxel “volumes” that can be freely positioned and rotated in your scene. It uses solid colors only (non-textured) to give you that 2D-pixelart-but-in-3D feel that tools such as MagicaVoxel and Qubicle embrace. But on top of that, you get the ability to animate your creations by creating more than one animation frame and cycling through them - much like creating a 2D spritesheet.

And to add even more value, there’s a set of scripts to help you use the voxel data at runtime. This is aimed more at desktops due to the processor-intensive nature of working with voxels, but with it you can explode, destruct, construct, collide with, and procedurally generate voxels in realtime.

PicaVoxel is available in the asset store now. I hope you enjoy using it as much as I enjoy working on it!

More information, videos and forums at picavoxel.com
Be sure to read the FAQ before purchasing!
View the Version History
Email support@picavoxel.com with any questions or tweet me.

1 Like

1.2 doesn’t compile to ios, I think the using UnityEditor code that’s inside Chunk is killing it. You need to case it with #if UNITY_EDITOR

I just caught this earlier, looks like I’ll be re-submitting then!

You’re right, simply add a directive around using UnityEditor:

#if UNITY_EDITOR
using UnityEditor;
#endif

Edit: have now submitted the fix as v1.2.1. Another week I guess.

Another one , 1.2 tears more than 1.1

Looking at that picture, it would be nice to have the self shadowing not as blocky, as a smooth vertex interpolation

Oh and another bug, or at least change in how things work. When I drop a volume prefab the object shows up but when I run the game in the editor, all instantiating of volume prefab ends up empty - dropping a prefab in a running scene or instantiating through code.
I know you changed how things are built in 1.2.

I believe the “tearing” you’re seeing is due to mesh compression. You can change this in the SetMesh() method in Chunk.cs:

MeshUtility.SetMeshCompression(mf.sharedMesh, ModelImporterMeshCompression.High);

Possible settings are Off,Low,Medium,High. Try a lower setting or turning it off completely. I’ll be exposing this in the inspector in 1.3.

Your second issue is because I have stopped the meshes from being rebuilt on awake on suggestion from another user. This has the knock-on effect that, because Unity doesn’t serialise meshes that are procedurally generated at edit-time, any volumes added to prefabs will no longer have a mesh unless you manually rebuild the chunks.

I’m looking for a fix for the prefab issue for 1.3, but in the meantime you have three options:

  1. Set your prefabbed volumes to Runtime-Only Mesh.
  2. In Frame.cs, change the following:
if (chunks == null && (ParentVolume != null && !ParentVolume.RuntimOnlyMesh))
                    CreateChunks();

to:

if (chunks == null && ParentVolume != null)
                    CreateChunks();
  1. Manually call CreateChunks() on your volume(s) from your own scripts.

When instantiating from a prefab in your own scripts, call CreateChunks() afterward (unless you use option 2 above).

I posted a little bit on my plans for 1.3 over on the PicaVoxel forums. Top of the list is to implement smooth vertex shading.

Your game’s looking great, btw!

I added CreateChunk in appropriate places and it works. Thanks.
It does add to the complexity of initializing objects.
Something you may want to consider for 1.3 is a mechanism, that tracks how an object is being created:

  • if instantiated and nothing else, call CreateChunk on start
  • if instantiated then FromCompressedByteArray, wait for deserialization then call UpdateAllChunksNextFrame

something like that, I’m sure there are other cases.

Why the mesh compression? Does it fare better on benchmarks? I’m asking because I’ve only experienced problems with mobile shaders when the mesh was compressed.

I added the mesh compression to help keep the scene filesize down, but didn’t realise how much the compression altered both colouring and vertex positioning. I’ve found that having it on Low is a good compromise. Like I say, I will include it as an Inspector option in 1.3.

Here’s a game that I made with my jam team during Ludum Dare 32, using PicaVoxel:


3 Likes

Really cool asset.

Does it work on Mobile? Iphone 4?

Cheers.

It does work on mobile platforms, and some people are doing great things with it on iPad - but I don’t officially support mobile platforms yet. The realtime destruction isn’t performant enough (yet) for me to recommend it for mobile. I am actively looking at that for the next version.

Please keep us updated with the mobile progress.

Very fun LD, Gareth, bankers kicked my teeth on day 2.
To Rocki, I use pica on A7-A8 and it runs with minmal hiccups. Just avoid meshcolliders if you’re on <5.0 and turn on culled meshing.

@ , your gzip library isn’t threaded I think.
I’m threading the saving of volumes which calls Frame.ToCompressedByteArray ();
but Frame.ToCompressedByteArray () does a GetComponent to initialize parentVolume. I had to remove it from line 640, maybe you can thread that function yourself or better you initialize parentVolume elsewhere, when the Frame gets created by Volume.

That’s the code calling ToCompressByteArray(), I removed line 640 from Frame and nothing is breaking (yet).

        public void Save ()
        {
            if (dirty)
                this.StartCoroutineAsync (SaveThreaded ());
        }
        IEnumerator SaveThreaded ()
        {
            byte[] byteArray = volume.GetCurrentFrame ().ToCompressedByteArray ();
            yield return Ninja.JumpToUnity;
            PlayerPrefsX.SetByteArray (id.ToString () + "/volume", byteArray);
            dirty = false;
        }
1 Like

Is there a way of generating some sort of terrain with the help of a heightmap with this asset. It has not to be infinite, but some sort of basic terrain generation would be very nice.

Hi!

So far I love Picavoxel and it has been to great help! But I feel like something is missing, which is illuminate voxels. It would be great if you could have some voxels on your model that are illuminated and being able to control the strength of each voxel. They don’t need to emit light or anything. I looks kinda weird making a torch model with fire that is quite dark so that is why this would be a great feature. :stuck_out_tongue:

Not in picavoxel, you have full access to the voxel generation though so you can make one.

What is the performance, What about drall calls?

1 mesh every chunk, which size is 16x16x16 voxel, all meshes sharing the same material so possibly batching if pica is set to greedy (decimation).
When you edit voxel at runtime, it’s slow on 4.6 due to physX being a dog at mesh collider rebuild. It’s ok on 5.x but either way, if you want to change large voxel volumes every frame, forget about it.

PicaVoxel 1.4 has been released. Please note that 1.4 drops support for Unity 4, but you can still download 1.3 via the asset store if you haven’t moved to Unity 5 yet. As always, please read the FAQ before purchasing!

And now, onto the good stuff:

Marching Cubes Meshing


Emissive and Mosaic shaders


Convert 3D model (mesh) to voxels


Import image as voxels

Face Overlap to eliminate mesh seam artefacts

And a bunch more exciting stuff. See this post on the PicaVoxel forum for the full 1.4.0 changeset.

Email support@picavoxel.com with any questions.

1 Like