Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including threejs-ply-loader with all npm packages installed. Try it out:

require("three/package.json"); // three is a peer dependency. var threejsPlyLoader = require("threejs-ply-loader")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

threejs-ply-loader v1.1.10

Node.js wrapper for three.js PLYLoader

ci   npm publish   npm version   npm

Three.js PLY file format loader to use with Node.js


Node.js wrapper for three.js PLYLoader (currently three.js v0.115.0).

Original PLYLoader source code can be found here.

Beside some minor edits, I added an additional helper function for converting Node Buffer to ArrayBuffer (convenience-wise) and I put in place tests.


const fs = require("fs");
const { join } = require("path");
const THREE = require("three");

// Require object constructor
const PLYLoader = require("threejs-ply-loader")(THREE);

// Instantiate PLYLoader object
const plyLoader = new PLYLoader();

// Read 3D Model as PLY file format
const sourceFilepath = join(__dirname, "assets/cube.ply");
const fileBuffer = fs.readFileSync(sourceFilepath);

// Convert node file Buffer to ArrayBuffer
const fileArrayBuffer = plyLoader.bufferToArrayBuffer(fileBuffer);

// Parse 3D model into THREE geometry
const geometry = plyLoader.parse(fileArrayBuffer);


An example is present in the examples folder. It will load a PLY file model and output its rendering to a PNG file. It can be run from a shell:

$ npm install
$ npm run example:cube-to-png

The output image is going to located in examples/temp/vertex-colored-cube.png


They can be run from a shell:

$ npm install
$ npm test

Development notes

Developed with Node v12.16.2

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free