Zarbuz / FileToVox

Tool for convert files into Magicavoxel file
MIT License
445 stars 46 forks source link

the generated blocks are very few and voxel is very tiny • SOLVED #50

Closed fffiloni closed 2 years ago

fffiloni commented 2 years ago

hello @Zarbuz ,

i am on macOs 10.15.7, and used the lastest release of FileToVox with this command: ./FileToVox --i /Users/sylvainfiloni/Downloads/rainbow\ 2.ply --o testvox3

I wonder why the vox file generated is very small, with a very low value for blocks. Here is the console output with the "rainbow 2.ply" file

 [INFO] FileToVox v1.14.0.0
[INFO] Author: @Zarbuz. Contact : https://twitter.com/Zarbuz
[INFO] Specified input path: /Users/sylvainfiloni/Downloads/rainbow 2.ply
[INFO] Specified output path: testvox3
[INFO] Specified output path: /Users/sylvainfiloni/Downloads/FileToVox-v1.14-osx/testvox3
[INFO] Start reading PLY data...
[INFO] Done.       
[INFO] Max X: 9,7875805, Y: 7,557913, 6,8279366
[INFO] Min X: 3,1533642, Y: 5,5825043, 0
[INFO] Size X: 6,6342163, Y: 1,9754086, 6,8279366
[INFO] Started to voxelize data...
[INFO] Done.       
[INFO] Started quantization of all colors ...
System.TypeInitializationException: The type initializer for 'Gdip' threw an exception.
 ---> System.PlatformNotSupportedException: System.Drawing.Common is not supported on non-Windows platforms. See https://aka.ms/systemdrawingnonwindows for more information.
   at System.Drawing.LibraryResolver.EnsureRegistered()
   at System.Drawing.SafeNativeMethods.Gdip.PlatformInitialize()
   at System.Drawing.SafeNativeMethods.Gdip..cctor()
   --- End of inner exception stack trace ---
   at System.Drawing.SafeNativeMethods.Gdip.GdipCreateBitmapFromScan0(Int32 width, Int32 height, Int32 stride, Int32 format, IntPtr scan0, IntPtr& bitmap)
   at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
   at FileToVox.Extensions.Quantization.CreateBitmapFromColors(List`1 blocks)
   at FileToVox.Extensions.Quantization.ApplyQuantization(List`1 blocks, Int32 colorLimit)
[INFO] Vox Width: 11
[INFO] Vox Length: 11
[INFO] Vox Height: 4
[INFO] Total blocks: 104
[INFO] Started to write chunks ...
[INFO] Done.
[INFO] Check total blocks after conversion: 104
[INFO] Done.

What did i do wrong ?

fffiloni commented 2 years ago

I get a voxel model but very tiny. Take a look at the "rainbow 2.ply" output on my machine:

Capture d’écran 2022-01-18 à 15 05 48

I'm missing something, but i don't know what

Zarbuz commented 2 years ago

You must specify the grid-size : --gs 256 for example

fffiloni commented 2 years ago

Alright it works, but i still get an error with colors, i read that i may need to install libgdiplus ? i did, but seems it's not working :(

[INFO] FileToVox v1.14.0.0
[INFO] Author: @Zarbuz. Contact : https://twitter.com/Zarbuz
[INFO] Specified input path: /Users/sylvainfiloni/Downloads/rainbow 2.ply
[INFO] Specified output path: testvoxwithgs
[INFO] Specified grid size: 256
[INFO] Specified output path: /Users/sylvainfiloni/Downloads/FileToVox-v1.14-osx/testvoxwithgs
[INFO] Start reading PLY data...
[INFO] Done.       
[INFO] Max X: 9,7875805, Y: 7,557913, 6,8279366
[INFO] Min X: 3,1533642, Y: 5,5825043, 0
[INFO] Size X: 6,6342163, Y: 1,9754086, 6,8279366
[INFO] Started to voxelize data...
[INFO] Done.       
[INFO] Started quantization of all colors ...
System.TypeInitializationException: The type initializer for 'Gdip' threw an exception.
 ---> System.PlatformNotSupportedException: System.Drawing.Common is not supported on non-Windows platforms. See https://aka.ms/systemdrawingnonwindows for more information.
   at System.Drawing.LibraryResolver.EnsureRegistered()
   at System.Drawing.SafeNativeMethods.Gdip.PlatformInitialize()
   at System.Drawing.SafeNativeMethods.Gdip..cctor()
   --- End of inner exception stack trace ---
   at System.Drawing.SafeNativeMethods.Gdip.GdipCreateBitmapFromScan0(Int32 width, Int32 height, Int32 stride, Int32 format, IntPtr scan0, IntPtr& bitmap)
   at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
   at FileToVox.Extensions.Quantization.CreateBitmapFromColors(List`1 blocks)
   at FileToVox.Extensions.Quantization.ApplyQuantization(List`1 blocks, Int32 colorLimit)
[INFO] Vox Width: 249
[INFO] Vox Length: 257
[INFO] Vox Height: 75
[INFO] Total blocks: 85990
[INFO] Started to write chunks ...
[INFO] Done.
[INFO] Check total blocks after conversion: 85990
[INFO] Done.
Capture d’écran 2022-01-18 à 16 49 13
Zarbuz commented 2 years ago

Yes this is a known issue for Mac, someone seems to made a fix here : https://github.com/Zarbuz/FileToVox/issues/46

fffiloni commented 2 years ago

Thanks Nicolas, i close this thread, as you solved the initial issue, and will open a new one if i can't handle the color related one ;)