voxwriter icon indicating copy to clipboard operation
voxwriter copied to clipboard

Unable to export with a high voxel detail

Open btcaboli opened this issue 1 year ago • 6 comments

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 avatar Sep 04 '23 02:09 btcaboli

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

btcaboli avatar Sep 04 '23 02:09 btcaboli

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 avatar Sep 04 '23 07:09 btcaboli

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 avatar Sep 04 '23 07:09 btcaboli

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 )

  • voxel detail = 1024 ==> successful but the file is same as 126 voxel detail
  • exported file with voxel detail of 1024 = exported file with voxel detail of 126

btcaboli avatar Sep 04 '23 08:09 btcaboli

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 avatar Sep 04 '23 08:09 btcaboli

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

btcaboli avatar Sep 21 '23 05:09 btcaboli