Skip to content

jackparmer/VoxelWorld

Repository files navigation

VoxelWorld

3d Numpy array in -> Voxel world out

Demo on Py.Cafe ☕

image

Install

From PyPi

pip3 install voxel_world

From source

git clone https://github.com/jackparmer/VoxelWorld.git
cd VoxelWorld
python3 -m pip install .

from voxel_world import VoxelWorld

About

For physics simulation, computer vision, games, art, whatever

Features!

  • Automatic GIF generation
  • Simple! Numpy 3d ones array in -> Voxel world out
  • Portable! Outputs images or standalone HTML files with Vixel
  • Notebooks! Works well in the Jupyter notebook ecosystem
  • Eye candy! Ambient occlusion, ray tracing from Vixel, etc

Examples

Surfaces API

from voxel_world import Volume, Surface;
volume = Volume(Volume.purlin_matrix(32)); surf = Surface(volume)
surf.color = (255,0,0)
volume.add(surf).show()
image

Random world

Demo on Py.Cafe ☕

import random
from voxel_world import Volume

Volume(
    Volume.purlin_matrix(16),
    theme=random.choice(list(Volume.themes.keys())),
    viewing_angle=(random.randint(0, 90), random.randint(0, 90)),
).render().show()
image

Ray tracing + WebGL renderer

from voxel_world import Volume, Vixel; vw = Volume(); vix = Vixel(vw); vix.html()
image

Animations

from voxel_world import Volume, Surface, Agent, Sequence

volume = Volume(Volume.purlin_matrix(64));
surf = Surface(volume);
agents = [Agent(surf, mask) for mask in Sequence.snake(grid_size=64, num_steps=1000)];
seq = Sequence(agents);

seq2 = seq.apply_bg(volume)

seq2.save('voxel_animation64_v2.gif')

image

image

image image image

Publishing to pip

python3 -m build
python3 -m twine upload --repository-url https://upload.pypi.org/legacy/ dist/*

About

Delicious Voxel worlds in Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages