Hello everyone
I decided a few days ago to make a editor tool that generates a voxel representation of any organic model. Im glad to say it has turned out rather well so far in that I have it working for mesh filter or any skinnedMesh models
Before any further explanations here is a web player preview :
http://www.shaderbytes.co.za/ian/voxel_generator/
Controls are :
click hold drag left mouse button to rotate models on x and y axis
click hold drag middle mouse button to translate the camera on the xy plane
mouse wheel to translate camera on z axis.
here is a screen shot of what you will see in the web player :
The tool generates a completely new character with all armatures and animations as per the source model. When testing a few different kind of models I realized that there is not always sufficient vertex data in the source to properly generate the new voxel mesh that will deform properly
I then wrote a subdivision utility (first phase only , no position smoothing) that subdivides the data of the original mesh and iterpolates the bone weights similar to how it is done in a regular 3d application when all edges have maximum creasing⌠I tested my results vs a subdivision done in blender to compare.
here is a screen shot to show you the results of this process in unity :
on the left is a simple 6 face 12 tri cube that has 2 bones to deform the mesh
on the right is the subdivided mesh (3 iterations ) showing how all the new vertices bone weights have been interpolated.
Using this data I then find the best suited vertex to transfer data to the voxel mesh, redo the bindposes and there it is If you have looked at the webplayer you will see 3 examples 20 ,30 ,40 unit generations. Have a look at the lowest 20 unit generation and you will see that ever there the deformations are behaving well.
Going forward I still want to iron out a few edge case situations in the face generation of the voxel mesh so its as optimal as can be and I will post some more examples soon.
When its finished I plan to put it up for sale on the asset store for $5 or $10 to try and make a little cash