Delicious Voxel worlds in Python
Project description
VoxelWorld
Create delicious Voxel worlds in Python
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, 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.4.tar.gz
(7.4 MB
view hashes)
Built Distribution
Close
Hashes for voxel_world-0.0.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5d3a87b2d57eeeb5dcd86b42ae305c6525159a2b979d40c8022392dd63cf181 |
|
MD5 | 8ee3bc2e6ce203d3296d455c7fd76368 |
|
BLAKE2b-256 | c275c3f92e212dfe0c149449017f4353d0f4fdd13cc74b70474f2acc84b442e0 |