simple voxel library
Project description
voxel_obj_lib_in_python
This is a simple libary for creating voxel 3D-obj files in python. There is another implementation in cpp (link: https://github.com/martinpflaum/voxel_obj_lib_in_cpp)
WorldGrid
takes as first parameter the 3d grid size of the world. In our example the grid would be of size 4x4x4. The second parameter of WorldGrid
is the size of the colorpallete. With a colorpallete of size 8, the textures you want to apply onto the object should be in a 8x8 grid. A 8x8 grid is for example 64x64 - each texture is then 8x8 pixel large. Its not that complicated just try some textures with same width and hight out.
In __setitem__
the first argument are the x,y,z coordinate of the cube you want to change. The second argument of __setitem__
is the colorvalue of the voxel. -1 stands for void. The colorvalue 0 corresponds to the pixel value at point 0,0 in texture palette. The obj() function returns the string that contains the objfile
from voxelobj import *
worldGrid = WorldGrid(4,8)
worldGrid[1,1,1] = 1
worldGrid[0,1,1] = -1
worldGrid[1,0,1] = -1
worldGrid[1,1,0] = -1
worldGrid[2,1,1] = -1
worldGrid[1,2,1] = -1
worldGrid[1,1,2] = -1
write("output.obj",worldGrid.obj())
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
Built Distribution
File details
Details for the file voxelobj-0.0.1.tar.gz
.
File metadata
- Download URL: voxelobj-0.0.1.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.5.0.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eda3604477d87c625c8afbbd6d73d91116f71ded63685adcb424018842abc464 |
|
MD5 | ba42515a88749b28db55da8ba0185b39 |
|
BLAKE2b-256 | 591b82414d7546336b08d354881f8061848fe0ca51262af0dfcfc0db38e07f5d |
File details
Details for the file voxelobj-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: voxelobj-0.0.1-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.5.0.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7af3886035c7e1856a5853e150cf54b5d035ab70a940aed18febdb088822c3ed |
|
MD5 | c8a5998e1d0e4ba37cac603f2c541ca0 |
|
BLAKE2b-256 | 0fd24da86c2e1a715342ee60ec2d58fa36dcfa035afb50d0e7baa4095a56102b |