Voxelize Meshes Script v.2
Thursday, February 25th, 2010With the help of the patient people in the python_inside_maya forum, I’ve improved the Voxelize Meshes Script, mostly by more efficient use of the allIntersections method.
Instead of checking each point on the grid to see whether it’s inside one of the target meshes, this version shoots rays through the meshes along each axis and puts blocks at the intersections. This makes it approximately a zillion times faster, though I’m sure it could still be improved.
Update: Richard Kazuo from the p_i_m forum has excised lingering traces of pymel from my script, I’ve updated the code below with his improved version. It should now run with Maya’s default Python installation. Thanks Richard!
Update 2: Here’s the even-more-efficient voxelize_meshes_v.3.py … I’m putting this to bed now.
Maya Python code:
(more…)

