Voxelate Script

Voxelate Script

Hi All,

just wanted to post this Polygon script I've been working on which converts objects into voxels (cube pixels). I've been using this for a few weeks now and seems quite stable but it can be slow with a large numbers of voxels and/or polygons in the underlying object. To get it to work place the object you want to voxelate as the first child of the Voxelate object.

Here is a quick run through of the parameters on the script:
Voxel Size: voxels are cubes this is the length/width/height
Origin: if origin is odd then a voxel is placed centred on origin, if even then the corners are placed on origin
Skin Tolerance: adjust what proportion (0-1) of voxel distance is detected as skin (fine tuning)
Skin Offset: adjust what position the skin is relative to actual polygons (-ve=inside, +ve=outside)

Y Truncate: trim top proportion of shape so you can see inside (useful for designing or fx)
Dissolve: remove a random proportion of the voxels (0-1)

Voxel Volume: proportion of voxel space filled by cube (0-1)
Cull Adjacent: if voxel volume is 1 then you can cull inside surfaces as you can't see them

Have fun and let me know any problems or queries,

Cheers, Tony
 

Attachments

  • Voxelate.js.zip
    4.1 KB · Views: 659
  • image.jpg
    image.jpg
    70.5 KB · Views: 844
Thank you, Tony
This is very useful for some trickery I have been pondering recently.
Greetings from Vienna
Helmut
 
Really fun script - especially when you combine it with iosurfaces (reduce resolution down to 8 lowest).
 

Attachments

  • Iosurface-and-Voxelate.mp4.zip
    523.3 KB · Views: 560

1. Put the script in the ~/user/library/application support/Cheetah 3d/Scripts/polygonobect
2. Restart C3d
3. Collapse your mesh if it's a parametric or if you've used a modifier / creator.
4. Select the script from the menu
5. Drag the object you want to Voxelate into the script in the object browser.
6. Adjust Voxel settings.

I think these are the proper steps. Modifiers / Creators may work without collapsing. I'm on my phone so I can't try it out.
 
Last edited:
Hey, thanks for the script. This will be really useful!

I was just wondering what the best way would be to texture the voxels individually - as in making each voxel look like a Minecraft dirt block. Perhaps is there a script out there that would automatically separate them into different objects? I tried UV mapping the entire thing (after making it a raw polygon object) but that didn't work.
 
Hey, thanks for the script. This will be really useful!

I was just wondering what the best way would be to texture the voxels individually - as in making each voxel look like a Minecraft dirt block. Perhaps is there a script out there that would automatically separate them into different objects? I tried UV mapping the entire thing (after making it a raw polygon object) but that didn't work.

I found if you set Voxel Volume to .999 and uncheck Cull Adjacent, then make it editable and you end up with full cubes
but disconnected. If you leave Cull Adjacent checked you get only the outside faces but disconnected.

 

I found if you set Voxel Volume to .999 and uncheck Cull Adjacent, then make it editable and you end up with full cubes
but disconnected. If you leave Cull Adjacent checked you get only the outside faces but disconnected.


Thanks for the tip. The problem is texturing the cubes - automatically unwrapping the UV for all of them together just doesn't work and it would take forever to do it manually. A nice feature of the script would be for it to create particles so I could put my own textured cube on them.
 
Neat script (I notice you're doing collision detection to calculate the interior). The script might be simpler (and more versatile) if it were implemented as a particle system (instead of building each voxel, just create a particle instance). Your voxels eliminate interior faces, but they're always cubes.
 
Back
Top