csg.js is a JavaScript library implementing constructive solid geometry (CSG) operations on polygonal meshes using BSP trees. With CSG, you build complex 3D shapes by combining primitives using Boolean operations like union, subtract, and intersect. The library focuses on clarity and correctness: its implementation is intentionally concise and readable so developers can understand the algorithm, while still correctly handling tricky edge cases such as overlapping coplanar polygons. A WebGL-based demo shows how two solids can be combined interactively in the browser, making it a great educational tool for learning CSG concepts. The API allows you to create primitives (cubes, spheres, etc.) and then combine or transform them programmatically, producing new mesh geometry for rendering or export. Because it is dependency-light and pure JavaScript, csg.js can be integrated into custom modeling tools, CAD-like apps, games, or procedural modeling pipelines running in the browser or Node.

Features

  • CSG operations (union, subtract, intersect) on polygonal meshes using BSP trees
  • Utility methods to construct primitives like cubes and spheres as starting solids
  • Correct handling of edge cases such as overlapping coplanar polygons
  • Pure JavaScript implementation suitable for browser or Node.js environments
  • Demo and docs that visualize operations with WebGL for interactive learning
  • Readable, educational codebase often used as a reference for CSG algorithms

Project Samples

Project Activity

See All Activity >

Categories

Libraries

License

MIT License

Follow csg.js

csg.js Web Site

Other Useful Business Software
$300 Free Credits for Your Google Cloud Projects Icon
$300 Free Credits for Your Google Cloud Projects

Start building on Google Cloud with $300 in free credits. No commitment, no credit card required until you're ready to scale.

Launch your next project with $300 in free Google Cloud credits—no strings attached. Test, build, and deploy without risk. Use your credits across the entire Google Cloud platform to find what works best for your needs. After your credits are used, continue with always-free tier services. Only pay when you're ready to scale. Sign up in minutes and start exploring.
Start Free Trial
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of csg.js!

Additional Project Details

Programming Language

JavaScript

Related Categories

JavaScript Libraries

Registered

2025-11-13