Delicious Voxel worlds in Python
Project description
VoxelWorld
Create delicious Voxel worlds in Python
Install
git clone https://github.com/jackparmer/VoxelWorld.git
cd VoxelWorld
python3 -m pip install .
from voxel_world import VoxelWorld
About
For physics simulation, games, art, and fun
Inspo: https://github.com/wwwtyro/vixel
Features!
- Automatic GIF generation
- Numpy 3d ones array in -> Voxel world out
- Fast-ish (as fast as rendering on the CPU can be)
- Portable! Outputs simple image files
- Notebooks! Works well in the Jupyter notebook ecosystem
- Eye candy! Ambient occlusion, specularity, etc
Known issues (TODO)
- Speed: Need to migrate to a GPU-based renderer while maintaining portability (suggestions?)
- Illumination: Light source ray tracing is wonky - but you can fake it (see light_source.py example)
- Cut offs: The bottom of some voxel cubes are cut off - I'm not sure why
- Likely much more...
Examples
Randomly generated worlds
import random
import numpy as np
from noise import pnoise3
from voxel_world import VoxelWorld
from IPython.display import display, Image as IPImage # Jupyter notebook
display(IPImage(data=VoxelWorld.Animations.create_voxel_img(
np.array([[[1 if pnoise3(x / 10.0, y / 10.0, z / 10.0) > random.uniform(-0.2, 0.2) else 0 for z in range(16)] for y in range(16)] for x in range(16)], dtype=np.uint8),
random.choice(list(VoxelWorld.themes.keys())),
resolution=10,
viewing_angle=(random.randint(0, 90), random.randint(0, 90)),
zoom=2.0,
show_light_source=False,
dark_bg=False
).getvalue()))
examples/sandworld.py
examples/light_source.py
examples/jill_of_the_jungle.py
examples/earth_tones.py
Mono-color themes
from voxel_world import VoxelWorld
world = VoxelWorld.show_themes() # Jupyter notebook only
Project details
Release history Release notifications | RSS feed
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.0.1.tar.gz
(8.8 kB
view hashes)
Built Distributions
Close
Hashes for voxel_world-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd458945b96be6f248b0bb4b6e8f97ad41277e5813688e19f01d3a38a6c725d8 |
|
MD5 | 7c5d453314312a3d2d9defd4b1648d4a |
|
BLAKE2b-256 | 6a89f710f6ddf09d08cf17df648aef0934bf28a98f5ffb45d478854dd885796c |
Close
Hashes for voxel_world-0.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 540d4c7ed751134dde5c8a61f08c4b2e361425de93cd2cf407366169c4053e16 |
|
MD5 | 76c844f3fee3b03fe45a554750a3de43 |
|
BLAKE2b-256 | 514500ebee996be4c569f5122d7daf1471bec0fca1117feeffc430803574940f |