{"id":15044731,"url":"https://github.com/danielesteban/softxels","last_synced_at":"2025-10-24T09:30:41.534Z","repository":{"id":57365722,"uuid":"386797881","full_name":"danielesteban/softxels","owner":"danielesteban","description":"Marching cubes renderer for three.js","archived":false,"fork":false,"pushed_at":"2022-07-02T02:06:07.000Z","size":25737,"stargazers_count":53,"open_issues_count":0,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-31T00:34:37.533Z","etag":null,"topics":["marching-cubes","threejs","wasm","webgl"],"latest_commit_sha":null,"homepage":"https://softxels.gatunes.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danielesteban.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"danielesteban"}},"created_at":"2021-07-17T00:32:04.000Z","updated_at":"2024-09-11T18:44:51.000Z","dependencies_parsed_at":"2022-08-23T20:10:47.176Z","dependency_job_id":null,"html_url":"https://github.com/danielesteban/softxels","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielesteban%2Fsoftxels","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielesteban%2Fsoftxels/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielesteban%2Fsoftxels/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielesteban%2Fsoftxels/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielesteban","download_url":"https://codeload.github.com/danielesteban/softxels/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237944085,"owners_count":19391588,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["marching-cubes","threejs","wasm","webgl"],"created_at":"2024-09-24T20:50:57.826Z","updated_at":"2025-10-24T09:30:39.954Z","avatar_url":"https://github.com/danielesteban.png","language":"JavaScript","funding_links":["https://github.com/sponsors/danielesteban"],"categories":[],"sub_categories":[],"readme":"[softxels](https://github.com/danielesteban/softxels/)\n[![npm-version](https://img.shields.io/npm/v/softxels.svg)](https://www.npmjs.com/package/softxels)\n==\n\n[![screenshot](screenshot.png)](https://github.com/danielesteban/softxels)\n\n### Examples\n\n* Editable world:\n  * Demo (cave worldgen): [https://softxels.gatunes.com/#/cave](https://softxels.gatunes.com/#/cave)\n  * Demo (terrain worldgen): [https://softxels.gatunes.com/#/terrain](https://softxels.gatunes.com/#/terrain)\n  * Demo (cave worldgen with persistence): [https://softxels.gatunes.com/#/cave/persist](https://softxels.gatunes.com/#/cave/persist)\n  * Demo (terrain worldgen with persistence): [https://softxels.gatunes.com/#/terrain/persist](https://softxels.gatunes.com/#/terrain/persist)\n  * Source: [example/main.js](example/main.js)\n\n* Random walkers:\n  * Demo: [https://softxels-walker.glitch.me](https://softxels-walker.glitch.me)\n  * Source: [https://glitch.com/edit/#!/softxels-walker](https://glitch.com/edit/#!/softxels-walker)\n  * Demo (react-three-fiber): [https://04s6kb.csb.app](https://04s6kb.csb.app)\n  * Source (react-three-fiber): [https://codesandbox.io/s/softxels-04s6kb](https://codesandbox.io/s/softxels-04s6kb)\n\n* Studio:\n  * Demo: [https://softxels-studio.gatunes.com](https://softxels-studio.gatunes.com)\n  * Source: [https://github.com/danielesteban/softxels-studio](https://github.com/danielesteban/softxels-studio)\n\n* Viewer:\n  * Demo: [https://softxels-viewer.gatunes.com](https://softxels-viewer.gatunes.com)\n  * Source: [https://github.com/danielesteban/softxels-viewer](https://github.com/danielesteban/softxels-viewer)\n\n* VR sculpting:\n  * Demo [https://softxels-xr.glitch.me](https://softxels-xr.glitch.me)\n  * Source: [https://glitch.com/edit/#!/softxels-xr](https://glitch.com/edit/#!/softxels-xr)\n\n### Installation\n\n```bash\nnpm install softxels\n```\n\n### Basic usage\n\n```js\nimport World, { WorldGen } from 'softxels';\nimport { PerspectiveCamera, Scene, sRGBEncoding, WebGLRenderer } from 'three';\n\nconst aspect = window.innerWidth / window.innerHeight;\nconst camera = new PerspectiveCamera(70, aspect, 0.1, 1000);\nconst renderer = new WebGLRenderer({ antialias: true });\nrenderer.outputEncoding = sRGBEncoding;\nrenderer.setSize(window.innerWidth, window.innerHeight);\n\nconst scene = new Scene();\nconst world = new World(WorldGen());\nscene.add(world);\n\nrenderer.setAnimationLoop(() =\u003e {\n  world.updateChunks(camera.position);\n  renderer.render(scene, camera);\n});\n```\n\n### World constructor\n\n```js\nnew World({\n  chunkMaterial: MeshBasicMaterial({ // A ThreeJS Material instance to render all chunks (default: null)\n    vertexColors: true,\n  }),\n  chunkSize: 32, // An uInt8 that controls the data/render chunks size (default: 32)\n  renderRadius: 5, // Controls the chunk radius updateChunks loads around the anchor (default: 5)\n  storage: { // An optional interface to load/store the chunk data\n    saveInterval: 5000, // The minimum time in between chunk saves in ms (default: 0)\n    async get(key), // An arbitrary async function that receives a chunk key and resolves the chunk data\n    set(key, value), // An arbitrary function that receives a chunk key and the data to be stored\n  },\n});\n```\n\n### WorldGen constructor\n\n```js\nnew WorldGen({\n  generator: null, // 'cave', 'terrain' or null to disable it (default: null)\n  seed: 1337, // A uInt32 seed to drive the world generation noise (default: Random)\n});\n```\n\n### updateChunks\n\n```js\n// This will load all the chunks around the anchor in the selected renderRadius\n// passed to the constructor.\n// It will also unload all the chunks further away (renderRadius + 2).\n// You should call this everytime you move the anchor.\n// It does remember the last chunk the anchor was in, so... It will only\n// update when the anchor crosses a chunk boundary.\nconst anchor = new Vector3(1, 2, 3);\nworld.updateChunks(anchor);\n```\n\n### updateVolume\n\n```js\nworld.updateVolume(\n  new Vector3(1, 2, 3), // A point in worldspace\n  2, // A uInt8 radius to update around the point\n  0xFF, // A uInt8 scalar where: \n        // 0 === OUTSIDE\n        // 0X80 === AT ISOSURFACE\n        // 0xFF === INSIDE\n  { r: 0x11, g: 0x22, b: 0x33 } // An optional 24bit sRGB color\n);\n```\n\n### Modifying the WASM programs\n\nTo build the C code, you'll need to install LLVM:\n\n * Win: [https://chocolatey.org/packages/llvm](https://chocolatey.org/packages/llvm)\n * Mac: [https://formulae.brew.sh/formula/llvm](https://formulae.brew.sh/formula/llvm)\n * Linux: [https://releases.llvm.org/download.html](https://releases.llvm.org/download.html)\n\nOn the first build, it will complain about a missing file that you can get here:\n[libclang_rt.builtins-wasm32-wasi-16.0.tar.gz](https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-16/libclang_rt.builtins-wasm32-wasi-16.0.tar.gz). Just put it on the same path that the error specifies and you should be good to go.\n\nTo build [wasi-libc](https://github.com/WebAssembly/wasi-libc), you'll need to install [GNU make](https://chocolatey.org/packages/make)\n\n```bash\n# clone this repo and it's submodules\ngit clone --recursive https://github.com/danielesteban/softxels.git\ncd softxels\n# build wasi-libc\ncd vendor/wasi-libc \u0026\u0026 make -j8 \u0026\u0026 cd ../..\n# install dev dependencies\nnpm install\n# start the dev environment:\nnpm start\n# open http://localhost:8080/ in your browser\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielesteban%2Fsoftxels","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielesteban%2Fsoftxels","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielesteban%2Fsoftxels/lists"}