I'm looking for a simple way to create a solid voxel sphere in Maya—something that looks like this: https://minecraftcirclesgenerator.com/ . Any suggestions?
isn't it just compute a grid of points (center of the voxel) if the point is inside the sphere (it's distance from the center is less than the radius) create the voxel else don't .
fn voxel_sphere radius segs =
(
size = 2 * radius/segs;
for h = 1 to segs do -- height (z)
for w = 1 to segs do -- width (x)
for l = 1 to segs do -- length (y)
(
-- compute the grid point
pos = [-radius + ((w - 1) * size), -radius + ((l - 1) * size), -radius + ((h - 1) * size)];
-- in sphere test (also a culling spherical test to stop max chugging like puffing billy)
if (length pos) < radius and (length pos) >= radius - size then
(
box width:size length:size height:size pos:(pos + [0,0,-size * 0.5]) wirecolor:blue;
)
)
)
delete geometry
voxel_sphere 10.0 30
result p.s. seems to work best with an odd number of segments
Blender does have a Remesh modifier with a Blocks option and using an icosphere might get more consistent results than an UVsphere (difference on the "north/south" poles and the other "axis poles"). To replicate the exact rasterization you might want to play with the scale factor of the modifier
Replies
I'm looking for a simple way to create a solid voxel sphere in Maya—something that looks like this: https://minecraftcirclesgenerator.com/ . Any suggestions?
Pretty simple for a sphere. I imagine a robot could probably generate some Maya python for it
It gets more complex if you need it to align with a world grid.
Can MASH do it?
result
p.s. seems to work best with an odd number of segments
.. or better yet decides to have it fill arbitrary meshes