PicaVoxel 1.4.5. Have mixed feelings & feedback.

0
Tomo posted this 15 December 2015

Hi All

I'm new to PicaVoxel. I started using version 1.3 for Unity 4 Pro and the build seemed rather incomplete to me. In many of the demos that involved destruction the explosions and particle creation was out of sync. The result would be a random order. On the island demo you might see the explosion right away and then a half to full second later you would see the mesh update and the player then would fall through the hole. The experience was very jarring. Many of the falling rotating particles would stop falling halfway through the floor. It doesn't take much voxel content to stutter the frame rate. Other things I noticed is that if you destruct a portion of an animated character like the space invader. The next frame of animation would loop the missing voxels back in and then out again. I also found it annoying that you could not restore / rebuild a volume after it was destroyed in v1.3. The included PDF manual doesn't include the v1.3 release notes. Note also the 1.4.5 PDF only shows 1.4 release notes.

So I downloaded version 1.4.5 and tested the build in Unity 5 free edition. My frame rate was cut in half or worse (20FPS!). I'm running picavoxel on a late 2014 Macbook Pro Retina with Intel Iris Pro and SSD.

I'm not entirely sure if Unity is still limiting the performance between Pro and Personal editions after U5 went free so I updated some of the PicaVoxel 1.4.5 code base to get it up running in Unity 4 Pro. I am definitely getting a much better frame rate on average 84FPS or higher for standalone player.

Gareth were you planning on making PicaVoxel more efficient? The demo scenes are relatively small and the performance doesn't scale well if we attempt to go larger. Maybe there is a way to implement a sparse voxel octree? I don't know if other users are experiencing similar issues for the free editions of Unity. I plan on sticking with Unity 4 Pro for now as I have too much invested in the plugins. Not that I plan on using PicaVoxel for Mobile. Note it was fairly easy to add U4 backwards compatibilty (#if UNITY_5) to PicaVoxel 1.4.5 if you keep the original PicaVoxel diffuse shaders as a fallback and swap CastShadows as bool when ShowCastingMode isn't available...

Example: Volume.cs

    #if (UNITY_5)
    public ShadowCastingMode CastShadows = ShadowCastingMode.On;
    // gameObject.GetComponent<meshrenderer>().castShadows = true;
    #else
    public bool CastShadows = true;
    #endif

Example: Frame.cs

        #if (UNITY_5)
        newChunk.GetComponent<meshrenderer>().shadowCastingMode = ParentVolume.CastShadows;
        #else
        newChunk.GetComponent<meshrenderer>().castShadows = ParentVolume.CastShadows;
        #endif

        newChunk.GetComponent<meshrenderer>().receiveShadows = ParentVolume.ReceiveShadows;
        chunks[chunkX, chunkY, chunkZ] = newChunk.GetComponent<chunk>();

Example VolumeInspector.cs

            #if UNITY_5
            castShadows.enumValueIndex =
                Convert.ToInt16(EditorGUILayout.EnumPopup("Cast Shadows",
                                                      (ShadowCastingMode) castShadows.enumValueIndex));
            #else
            //EditorPrefs.SetBool ("Cast Shadows", (bool)castShadows.boolValue);    
            castShadows.boolValue = EditorGUILayout.ToggleLeft(new GUIContent(" Cast Shadows"),
                                                               castShadows.boolValue);
            #endif

            #if UNITY_5
            if (castShadows.enumValueIndex != Convert.ToInt16(voxelObject.CastShadows))
            #else
                if (castShadows.boolValue != voxelObject.CastShadows)
            #endif
            {
                foreach (var o in serializedObject.targetObjects)
                {
                    #if UNITY_5
                    ((Volume) o).CastShadows = (ShadowCastingMode) castShadows.enumValueIndex;
                    #else
                    ((Volume) o).CastShadows = castShadows.boolValue;
                    #endif
                    ((Volume) o).CreateChunks();
                }
            }

This is only a few examples. I can provide the rest if you want it. Most changes were minor. Spent a little over an hour on this haven't tested the real time editing or the new image / mesh to vox features but most of the demos run fine. The PicaDerby demo prefabs / script needs to be from PicaVoxel v1.3 obviously. Why not include a Unity 4 asset package of PicaVoxelDemos folder to import?

Btw you should update Destruct in Volume.cs to hide the voxels or it will create black voxels in it's place.

    public void Destruct(float particleVelocity, bool actuallyDestroyVoxels)
    {
    // if(actuallyDestroyVoxels) SetVoxelAtArrayPosition(x, y, z, new Voxel() { State = VoxelState.Hidden }); // 1.4.5 original
    if(actuallyDestroyVoxels) SetVoxelStateAtArrayPosition(x, y, z, VoxelState.Hidden);

If you do not change this any previously exploded voxels will be replaced with black cubes after you Destruct the entire volume.

Note it may also be quicker to deactivate the renderer or the game object state. Then reactivate on a Rebuild.

I hope this helps. I understand you are not continuing support for Unity 4 but I feel users should be able to do better than v1.3 of PicaVoxel.

-Tom

3 Comments
Order By: Standard | Newest | Votes
0
GarethIW posted this 16 December 2015

Hi Tom,

Thanks for the honest and constructive feedback, always appreciated!

I'd like to try and focus on why you're getting worse performance in Unity 5 compared to Unity 4. That's not right. When you say your framerate was cut in half in Unity 5, is there a demo in particular that you see that with? Is this an in-editor or built measurement?

While I do the majority of PicaVoxel's development on a gaming PC, I have an early 2014 Mac Mini that I test on which should roughly be similar specs to your laptop. Unity 5 has always given better performance than 4.

That said, I probably should go back for one last update the the Unity 4 package as (like you have found) a lot of the improvements will work fine.

Notes about some other things you bought up:

Other things I noticed is that if you destruct a portion of an animated character like the space invader. The next frame of animation would loop the missing voxels back in and then out again

You're right, changes to voxels have always been limited to the current animation frame. It should probably be an option to affect all frames so I'll add that to the to-do for next release.

The included PDF manual doesn't include the v1.3 release notes. Note also the 1.4.5 PDF only shows 1.4 release notes.

I'm pretty bad at updating the manual, I'll admit. I did a massive update with 1.4. The latest release notes are always posted here on the forum though.

Gareth were you planning on making PicaVoxel more efficient? The demo scenes are relatively small and the performance doesn't scale well if we attempt to go larger. Maybe there is a way to implement a sparse voxel octree?

I'm going to be completely honest here. I am not a maths guru. The meshing algorithms I'm using are tried and tested and widely used, and I simply ported them to C# and added the sugar to support PicaVoxel's features. They may not be the best, but they perform reasonably well and a lot better than most of the Voxel assets on the store.

The trouble is, after the meshing is done you still have to update the mesh object by setting the vertex arrays on the mesh. Updating the mesh in Unity happens on the main CPU thread (you can't multithread it) and is the major bottleneck of procedurally generating meshes at runtime. This delay is even worse if you're updating a meshcollider as well.

On top of that, you have the general speed of the outdated Mono runtime that Unity relies on. Hopefully this will become less of an issue once IL2CPP is available for all platforms.

I'm not trying to blame Unity for all of PicaVoxel's shortcomings. I'm sure there is more that I could do if I could warrant spending all of my free time on it. But then it would need to sell for a heck of a lot more than $25.

PicaVoxel only exists because people were watching my game development stream for Jarheads and asked me if I was ever going to make the engine available as an asset. I could never do that because it would be nowhere near user-friendly enough. But it did give me the idea for PicaVoxel, and I never expected it to take off the way it did.

Btw you should update Destruct in Volume.cs to hide the voxels or it will create black voxels in it's place.

Good catch, I'll fix that next time.

Note it may also be quicker to deactivate the renderer or the game object state. Then reactivate on a Rebuild.

That's not really for PicaVoxel to decide. The solution there would be to call destruct with actuallyDestroyVoxels=false and then deactivate the object yourself.

0
Tomo posted this 16 December 2015

Having a low price point is extremely nice. Most asset store prices go up once software advances beyond the beta phase. What I like about PicaVoxel is that you included some demos to showcase the features. Note there is one other voxel package that is very similar to yours with demos and mobile support but the developer gave up on Unity 4 compatibility which brought me here.

That's not really for PicaVoxel to decide. The solution there would be to call destruct with actuallyDestroyVoxels=false and then deactivate the object yourself.

True but I was speaking in terms of ActuallyDestroyVoxels = true; in regards to the overhead costs of actually hiding voxels adds no visual benefit to a volume's destruction animation. However I like that the code is there to help demonstrate how one could traverse a volume's frame data.

I suspect the better to worse frame-rate is running a project inside Unity Pro vs Unity free. As mentioned I don't have U5 Pro to compare with only U4 Pro. Most of my initial tests were running the standalone demos in-editor at full screen. The PicaDerby seemed good enough.

Documentation - the bane of all good labors. Providing some code snippets of what's new would totally rock.

Thank you for your speedy reply btw very much appreciated.

0
Tomo posted this 18 December 2015

Just wanted to add the Marching Cubes mode doesn't look right for 3 of the 4 parapets on the Castle MagicaVoxel import. Tested on Unity 4 & 5.

Marching Cubes artifacts for PicaVoxel 1.4.5


Our 123 members have posted 454 times in 109 discussions