Skip to main content

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())

Release files for voxelobj 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for voxelobj 0.0.1
File Size Uploaded
voxelobj-0.0.1.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for voxelobj 0.0.1
File Interpreter ABI Platform
voxelobj-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 9.4 kB

Release files / voxelobj-0.0.1.tar.gz

Download URL voxelobj-0.0.1.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
eda3604477d87c625c8afbbd6d73d91116f71ded63685adcb424018842abc464
BLAKE2b-256 checksum
How to use checksums
591b82414d7546336b08d354881f8061848fe0ca51262af0dfcfc0db38e07f5d
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / voxelobj-0.0.1-py3-none-any.whl

Download URL voxelobj-0.0.1-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7af3886035c7e1856a5853e150cf54b5d035ab70a940aed18febdb088822c3ed
BLAKE2b-256 checksum
How to use checksums
0fd24da86c2e1a715342ee60ec2d58fa36dcfa035afb50d0e7baa4095a56102b
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page