Isometric Voxel Generator.
Can be used to take an input texture such as this one:
And turn it into a 2.5D Bloxel with this command:
bloxel "examples/res/Grass.png"
Resulting in this image:
Note that the sides have been properly shaded.
pip install git+https://github.com/Pebaz/bloxel.git
Or if done via Git:
git clone https://github.com/Pebaz/bloxel.git
pip install -r requirements.txt
bloxel [ -o <out-path>] [ -a | ([ -nsew])] [ -b <blockname>] <all-sides>
bloxel [ -o <out-path>] [ -a | ([ -nsew])] -b <blockname> <up> <rest-sides>
bloxel [ -o <out-path>] [ -a | ([ -nsew])] -b <blockname> <up> <down> <rest-sides>
bloxel [ -o <out-path>] [ -a | ([ -nsew])] -b <blockname> <up> <down> <left> <right> <front> <back>
bloxel [ -o <out-path>] [ -a | ([ -nsew])] -t <tex> <num-wide> <num-long> [<block-file>]
bloxel -c <filename> <red> <green> <blue> [<alpha>] [--width=<width> --height=<height>]
bloxel -h | --help | -v | --version
Bloxel is also designed to be imported as a library when needed:
import bloxel
texture_size = 4
iso = bloxel.iso.Iso(texture_size)
grass = iso.get_texture('examples/res/Grass.png')
direction = bloxel.Directions.NORTH
bloxel = iso.get_scalar_bloxel(direction, *([grass] * 6))
# Saves file as: './Bloxel-Grass-N.png'
iso.save(bloxel, direction, 'Grass', '.')
bloxel -b MyBlock Grass.png
bloxel -b MyBlock -nw Grass.png
bloxel -b MyBlock Grass.png Dirt.png
bloxel -b MyBlock -ne Grass.png Dirt.png
bloxel -b MyBlock -a Grass.png Dirt.png
bloxel -c "BlueBlock.png" 0 0 255 --width=16 --height=16
bloxel -o "examples/TexMap" -n -t "examples/Sample.png" 2 2
Given this texture map:
Generate these four blocks and put them in examples/TexMap/
bloxel -t examples/res/Texture-Map.png 2 2 examples/example.blockfile -o examples/blockfile-out
A blockfile can enable a massive number of explicitly-named blocks to be created easily. The need for this automation is because a texture map is literally an image that contains a grid of sub-images that get turned into bloxels. The generated bloxels have randomly-generated names so there must be a better way to name them. In addition, each sub-image is turned into a bloxel with that image being used for each side. Complex multi-image bloxels can be created easily by putting them into the blockfile to be read in one by one and generated.
Example blockfile syntax:
0 # Grass
1 # Dirt
2 # Concrete
3 # Water
0 1 # Piston
0 2 # Oven
0 1 2 # Stove
0 1 2 3 # CrackedStone1
0 1 2 3 2 1 # CrackedStone2
Each line can be thought of as a different invocation of the CLI. The arguments are the same in regards to the chosen images and the name of the bloxel. Each number corresponds to the index of the image within the texture map. Everything after the #
is the name of the bloxel (whitespace stripped off of the left and right sides). Lines with no #
are given randomly-generated strings as names. If this is the input image:
This is the sequence of the indexes go from left to right and top to bottom (just like reading):
0 (Rune)
1 (Dirt)
2 (Colorful Tile)
3 (Stone Tile)
The result of a texture map + blockfile combo is a number of bloxels that have a name rather than being randomly-generated.