Skip to content

Can it be used with parallel.js #26

Open

Description

@aradhyamathur

I wanted to know if the voxelization process could be parallelized using parallel.js to process multiple obj files in parallel.

Activity

  1. andstor commented on Dec 21, 2020

    @andstor
    Owner

    Hi!
    I am not very familiar with paralell.js. However, since the actual voxelizer engine doesn’t use any GPU calculations, it should be quite possible to run several voxelization processes in parallel. I took a very quick look at the library, and from what I can tell you should be able to voxelize multiple OBJ files with it 👌

  2. aradhyamathur commented on Dec 22, 2020

    @aradhyamathur
    Author

    Upon running it with parallel.js the binvox do not get generated, also i did not observe error message. I created a function to export voxels from obj file paths. The function exportBinvox takes the source and desitnation paths stored in paths and exports the binvox.
    Can you please guide what could be the possible cause for it ?

    
      function exportBinvox(paths){
    
        var manager = new THREE.LoadingManager();
    
        var loader = new THREE.OBJLoader( manager );
        loader.load(paths[0],
            function(object){
                const sampler = new Sampler('raycast', options);
                const resolution = 512;
                let data = sampler.sample(object, resolution);
                
                const fs = require('fs');
                const binexporter = new BINVOXExporter();
                
                binexporter.parse(data, function (binvox) {
                   fs.writeFile(paths[1], Buffer.from(binvox), function(err){
                     if (err) return console.log(err);
    
                   });
                });
            },function ( xhr ) {
    
        // console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
    
            },
            // called when loading has errors
            function ( error ) {
    
              console.log( 'An error happened : ' + paths[0]);
              console.log(error);
    
            }
        )
      
      }
    
    
            var Parallel = require('paralleljs');
    
            var p = new Parallel(paths);
            log = function () { console.log('done'); };
    
            p.map(exportBinvox).then(log)
            console.log('done');
    
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions