Skip to main content

Delicious Voxel worlds in Python

Project description

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

examples/color_matrix/sand_world.py

image

examples/lighting/light_source.py

image

Publishing to pip

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

voxel_world-0.1.4.tar.gz (11.8 MB view hashes)

Uploaded Source

Built Distribution

voxel_world-0.1.4-py2.py3-none-any.whl (11.5 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page