node-jsc3d
Node wrapper for JSC3D, a cool little (unmaintained?) 3D model renderer originally written for the browser.
Supports in-memory, software rendering of certain 3D Models with a simple interface, great for generating previews of STL or OBJ files.
Usage
Install locally with:
npm install --save jsc3d
NOTE: It (presently) relies on node-canvas
for PNG rendering and
canvas implementation. This requires Cairo and Pango to be installed on
the host system. Read more
here.
As library
render
helper method
Using Provides a few helper methods, notably render
, for more easily
interacting with JSC3D. See bin/jsc3d.js
for full example of using
render
.
const jsc3d = ;const canvas = jsc3d;jsc3d;
Using JSC3D directly
The original JSC3D API is also directly exposed.
const jsc3d = ;const canvas = jsc3d;const viewer = canvas;viewer;viewer;viewer; jsc3d;viewer;
As stand-alone program
Install globally with
npm install -g jsc3d
Solid render
jsc3d examples/example.stl examples/example.png
Example wireframe render
This node wrapper exposes all arguments as CLI arguments, also.
jsc3d \
--ModelColor=#00ff00 \
--RenderMode=wireframe \
--BackgroundColor1=#000000 \
--BackgroundColor2=#000000 \
examples/example.stl \
examples/example_wireframe.png
License
To match JSC3D, this wrapper is also released under MIT License.
TODO
-
Background images do not load: need to mock HTML Image interface
-
Implement new, simpler mock canvas using Buffer to avoid Cairo dependency
-
Monkey patch JSC3D's BinaryStream with a faster implementation using Buffer