Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to export with a high voxel detail #15

Open
btcaboli opened this issue Sep 4, 2023 · 6 comments
Open

Unable to export with a high voxel detail #15

btcaboli opened this issue Sep 4, 2023 · 6 comments

Comments

@btcaboli
Copy link

btcaboli commented Sep 4, 2023

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
Copy link
Author

btcaboli commented Sep 4, 2023

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

@btcaboli
Copy link
Author

btcaboli commented Sep 4, 2023

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
Copy link
Author

btcaboli commented Sep 4, 2023

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
Copy link
Author

btcaboli commented Sep 4, 2023

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
Copy link
Author

btcaboli commented Sep 4, 2023

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant