Spyduck / voxwriter

Blender addon to export to the MagicaVoxel .vox format
GNU General Public License v3.0
46 stars 12 forks source link

Unable to export with a high voxel detail #15

Open btcaboli opened 1 year ago

btcaboli commented 1 year ago

I just test it and find that its most voxel detail is 126 When I change the code in init file where voxelize(context.active_object, self.filepath, vox_detail=max(0,min(126,self.voxel_detail)), use_default_palette=self.use_default_palette) from 126 to 1024 I can export to voxel detail of 256 but more than that I will face with a python error says ubyte format requires 0 <= number <= 255 I cannot solve this problem

btcaboli commented 1 year ago

99% of its job is done. The only problem is on writing converted object to a file

btcaboli commented 1 year ago

Actually when I enter a number into voxel detail field I have not any restriction. I can enter a number greater than 126. The interesting fact is that when I enter a number greater than 126 the process of exporting and converting will take more time but the final file result is always equivalent to 126 voxel detail 126 voxel detail file = 127 voxel detail file = 10240 voxel detail file There is not any cube ( voxel/ pixel ) that is different in the above examples however we have different voxel detail numbers and the process of exporting takes much more time

btcaboli commented 1 year ago

error is

Palette length 1
Python: Traceback (most recent call last):
  File "/home/abol/.config/blender/3.0/scripts/addons/voxwriter-master/__init__.py", line 45, in execute
    voxelize(context.active_object, self.filepath, vox_detail=max(0,min(1024,self.voxel_detail)), use_default_palette=self.use_default_palette)
  File "/home/abol/.config/blender/3.0/scripts/addons/voxwriter-master/writer.py", line 236, in voxelize
    VoxWriter(file_path, vox).write()
  File "/home/abol/.config/blender/3.0/scripts/addons/voxwriter-master/pyvox/writer.py", line 48, in write
    chunks.append((b'XYZI', pack('i', len(m.voxels)) + b''.join(pack('BBBB', *v) for v in m.voxels)))
  File "/home/abol/.config/blender/3.0/scripts/addons/voxwriter-master/pyvox/writer.py", line 48, in <genexpr>
    chunks.append((b'XYZI', pack('i', len(m.voxels)) + b''.join(pack('BBBB', *v) for v in m.voxels)))
struct.error: ubyte format requires 0 <= number <= 255

location: <unknown location>:-1
btcaboli commented 1 year ago

I can export more than 255 with voxelize 126( files have same size ) This is the case that your code is not changed if I use a voxel detail more than 255 there is not any problem ( ubyte error is not thrown )

btcaboli commented 1 year ago

In the previous mode we can export with more than 256 voxel detail but the files are similar but in this mode we face with ubyte out of range error This is the case that your code is changed ( change number 126 to 1024 ) Now if I change the voxel detail from 126 to 255 the exported file is different exported file with voxel detail of 255 != exported file with voxel detail of 126 But if I use a voxel detail more than 255 I will face with ubyte error and the file is not exported however it is processed to 99%

btcaboli commented 11 months ago

The images for importing final results using Goxel application from your plugin export