{"id":20649266,"url":"https://github.com/repalash/xatlas-three","last_synced_at":"2025-04-30T07:50:12.446Z","repository":{"id":50451829,"uuid":"487277889","full_name":"repalash/xatlas-three","owner":"repalash","description":"XAtlas + Three.js: Mesh parameterization / UV unwrapping module for three.js in wasm with webworkers.","archived":false,"fork":false,"pushed_at":"2024-09-28T11:33:00.000Z","size":465,"stargazers_count":95,"open_issues_count":6,"forks_count":16,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-30T14:09:50.694Z","etag":null,"topics":["mesh","threejs","uv","xatlas","xatlas-web"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/repalash.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-30T12:58:01.000Z","updated_at":"2025-03-28T13:23:14.000Z","dependencies_parsed_at":"2025-01-09T07:05:00.902Z","dependency_job_id":"a9ecf9a8-aba3-4d84-8276-82b75aca6c83","html_url":"https://github.com/repalash/xatlas-three","commit_stats":{"total_commits":22,"total_committers":2,"mean_commits":11.0,"dds":0.2727272727272727,"last_synced_commit":"8ae9119546b5bcdf48ecd049456ca3781c3bc69c"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/repalash%2Fxatlas-three","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/repalash%2Fxatlas-three/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/repalash%2Fxatlas-three/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/repalash%2Fxatlas-three/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/repalash","download_url":"https://codeload.github.com/repalash/xatlas-three/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251666227,"owners_count":21624291,"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":["mesh","threejs","uv","xatlas","xatlas-web"],"created_at":"2024-11-16T17:13:27.665Z","updated_at":"2025-04-30T07:50:12.425Z","avatar_url":"https://github.com/repalash.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xAtlas-three\n[xAtlas](https://github.com/jpcy/xatlas) + [three.js](https://github.com/mrdoob/three.js): Mesh parameterization / UV unwrapping module for three.js in wasm with webworkers.\n\nCan be used to unwrap UVs in `BufferGeometry` or pack multiple geometries into a single atlas for lightmap/AO baking.\n\nTo use xatlas in JS without three.js you can use [xatlas.js](https://github.com/repalash/xatlas.js) directly.\n\n## Examples\nUnwrap geometry and debug UV\n[./public/uvs-debug.html](./public/uvs-debug.html) \u003cbr\u003e \nDemo: https://repalash.com/xatlas-three/public/uvs-debug.html\n\nPack multiple geometries into a single atlas and unwrap GLTF\n[./public/pack-atlas.html](./public/pack-atlas.html) \u003cbr\u003e \nDemo: https://repalash.com/xatlas-three/public/pack-atlas.html\n\n## Usage\nInstall via [npm](https://www.npmjs.com/package/xatlas-three) by running:\n```sh\nnpm install xatlas-three\n```\n\nCreate an instance for `UVUnwrapper` and optionally set the packing and charting options for `xatlas`.\n```js\n    const unwrapper = new UVUnwrapper({BufferAttribute: THREE.BufferAttribute});\n    \n    // Default options\n    unwrapper.chartOptions = {\n        fixWinding: false,\n        maxBoundaryLength: 0,\n        maxChartArea: 0,\n        maxCost: 2,\n        maxIterations: 1,\n        normalDeviationWeight: 2,\n        normalSeamWeight: 4,\n        roundnessWeight: 0.009999999776482582,\n        straightnessWeight: 6,\n        textureSeamWeight: 0.5,\n        useInputMeshUvs: false,\n    }\n    unwrapper.packOptions = {\n        bilinear: true,\n        blockAlign: false,\n        bruteForce: false,\n        createImage: false,\n        maxChartSize: 0,\n        padding: 0,\n        resolution: 0,\n        rotateCharts: true,\n        rotateChartsToAxis: true,\n        texelsPerUnit: 0\n    }\n\n```\n\nNext load the [xatlasjs](https://github.com/repalash/xatlas.js) library:\n```js\n\nawait unwrapper.loadLibrary(\n    (mode, progress)=\u003e{console.log(mode, progress);},\n    'https://cdn.jsdelivr.net/npm/xatlasjs@0.2.0/dist/xatlas.wasm',\n    'https://cdn.jsdelivr.net/npm/xatlasjs@0.2.0/dist/xatlas.js',\n); // Make sure to wait for the library to load before unwrapping.\n\n```\nHere jsdelivr cdn link is used to load the xatlas.js library, any custom link can be passed.\nCheck [xatlasjs on npmjs](https://www.npmjs.com/package/xatlasjs) for more details and latest version\n\nTo unwrap a `THREE.BufferGeometry`: \n```js\n    await unwrapper.unwrap(geometry);\n```\nHere, generated UVs will be written to 'uv' attribute, and any original uvs will be written to 'uv2' attribute. This can be customised by passing in a custom attribute name.\n\nNote: only indexed geometry is supported, a non-indexed geometry can be converted to indexed geometry using `THREE.BufferGeometryUtils.mergeVertices`. See any example for details.\n\nTo Pack multiple geometries into a single atlas\n```js\n\n    await unwrapper.packAtlas([geometry1, geometry2, geometry3, ...]);\n\n```\nHere, generated UVs will be written to the 'uv2' attribute of each geometry, this can be customized by passing in a custom attribute name.\n\nNote: \n* xatlas might add or remove some vertices data.\n* interleaved geometry is not yet supported.\n\n## Nodejs (not tested)\n\nImport the `UVUnwrapper` class from `src/unwrapperNodeWorker` and load xatlas.js(`worker.mjs` and `xatlas.wasm`) from node_modules/other local path.\n\nSee `./test/node-worker.ts` for an example. Run with `npx tsx test/node-worker.ts`\n\n## Development\n\n### Installing dependencies\n\n    npm install\n\n### Running the project in watch mode\n\n    npm start\n\n### Building the project\n\n    npm run build\n\n\n## Changelog\n\n### 0.2.1\n- Update xatlasjs to 0.2.0\n- `packAtlas` and `unwrapGeometry` methods return the `Atlas` object instead of the list of geometries. Use `atlas.geometries` to get the list of geometries.\n- Any subMesh data (in case of multiple sub-atlas), is saved to `userData.xAtlasSubMeshes` of the geometry.\n- Throws error in-case of invalid inputs.\n\n### 0.1.0\n- Initial release\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frepalash%2Fxatlas-three","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frepalash%2Fxatlas-three","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frepalash%2Fxatlas-three/lists"}