Skip to content
angelxuanchang edited this page Aug 23, 2018 · 2 revisions

The SceneToolkit supports working with voxels in several ways.

Generating colored voxelization of models

Voxels can be generated using the server-side compute (ssc) scripts. See Assets for how to add your asset to the scene toolkit. See Headless-Rendering for how to setup headless rendering..

Use ssc/color-voxels to surface colored voxels for a model.

  1. To create surface color voxels at resolution 128^3:

    NODE_BASE_URL=path/to/data ssc/color-voxels.js --source 3dw --id b192cda468f9390aa3f22b4b00de6dfb --format obj --resolution 128

Voxel outputs are saved in the nrrd format.

  1. To create solid color voxels, you will need to have a initial solid voxelization to start with. For ShapeNetCore models, we have solid voxelizations generated using binvox.

    NODE_BASE_URL=path/to/data ssc/color-voxels.js --source 3dw --id b192cda468f9390aa3f22b4b00de6dfb --format obj --voxels voxels-solid-256 --downsample 2

Note that the voxels are generated by direct sampling of the mesh surface and colors. For improved voxels, it is recommended that the output voxels are further downsampled and filtered.

Batch rendering of voxelizations

Generated voxels can be rendered using the server-side compute (ssc) scripts.

Use ssc/render-voxels to renders voxels (size of voxel determined by alpha channel, use --size 0.8 to render fixed size voxels). Both binvox and nrrd formats are supported.

  1. Render single view

    scc/render-voxels.js --input b192cda468f9390aa3f22b4b00de6dfb.nrrd

  2. Render single view with png compression (requires pngquant)

    ssc/render-voxels.js --input b192cda468f9390aa3f22b4b00de6dfb.nrrd --compress_png

  3. Render turntable mp4 at steps of 10 degrees (requires ffmpeg)

    ssc/render-voxels.js --input b192cda468f9390aa3f22b4b00de6dfb.nrrd --render_turntable --turntable_step 10

Viewing voxelizations of models and scenes online

If you start the SSTK server, you can view generated voxelizations go going to http://localhost:8010/voxel-viewer.html and select "Load" (upper right corner).

Clone this wiki locally