{"id":13534331,"url":"https://github.com/marcofugaro/three-projected-material","last_synced_at":"2025-10-08T10:27:36.214Z","repository":{"id":36942491,"uuid":"227646603","full_name":"marcofugaro/three-projected-material","owner":"marcofugaro","description":"📽 Three.js Material which lets you do Texture Projection on a 3d Model","archived":false,"fork":false,"pushed_at":"2024-07-04T15:05:59.000Z","size":19240,"stargazers_count":694,"open_issues_count":4,"forks_count":59,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-05-23T05:12:35.570Z","etag":null,"topics":["texture-mapping","texture-projection","threejs","threejs-example"],"latest_commit_sha":null,"homepage":"https://marcofugaro.github.io/three-projected-material/","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/marcofugaro.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":"2019-12-12T16:12:55.000Z","updated_at":"2025-05-21T04:17:57.000Z","dependencies_parsed_at":"2024-01-03T04:06:10.507Z","dependency_job_id":"e4f87ee2-576a-41f5-816c-f5ecb3d3abbb","html_url":"https://github.com/marcofugaro/three-projected-material","commit_stats":{"total_commits":108,"total_committers":4,"mean_commits":27.0,"dds":0.04629629629629628,"last_synced_commit":"b19a3361b5f365ffef7ce31bf6b488d838727a52"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/marcofugaro/three-projected-material","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcofugaro%2Fthree-projected-material","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcofugaro%2Fthree-projected-material/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcofugaro%2Fthree-projected-material/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcofugaro%2Fthree-projected-material/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcofugaro","download_url":"https://codeload.github.com/marcofugaro/three-projected-material/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcofugaro%2Fthree-projected-material/sbom","scorecard":{"id":618074,"data":{"date":"2025-08-11","repo":{"name":"github.com/marcofugaro/three-projected-material","commit":"b19a3361b5f365ffef7ce31bf6b488d838727a52"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.5,"checks":[{"name":"Code-Review","score":1,"reason":"Found 3/29 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":10,"reason":"GitHub workflow tokens follow principle of least privilege","details":["Info: topLevel 'contents' permission set to 'read': .github/workflows/deploy-github-pages.yml:10","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/deploy-github-pages.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/marcofugaro/three-projected-material/deploy-github-pages.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/deploy-github-pages.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/marcofugaro/three-projected-material/deploy-github-pages.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/deploy-github-pages.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/marcofugaro/three-projected-material/deploy-github-pages.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/deploy-github-pages.yml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/marcofugaro/three-projected-material/deploy-github-pages.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/deploy-github-pages.yml:51: update your workflow using https://app.stepsecurity.io/secureworkflow/marcofugaro/three-projected-material/deploy-github-pages.yml/master?enable=pin","Info:   0 out of   5 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 5 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"25 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-67mh-4wv8-2f99","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-353f-5xf4-qw67","Warn: Project is vulnerable to: GHSA-c24v-8rfc-w8vw","Warn: Project is vulnerable to: GHSA-8jhw-289h-jh2g","Warn: Project is vulnerable to: GHSA-64vr-g452-qvp3","Warn: Project is vulnerable to: GHSA-9cwx-2883-4wfx","Warn: Project is vulnerable to: GHSA-vg6x-rcgg-rjx6","Warn: Project is vulnerable to: GHSA-x574-m823-4x7w","Warn: Project is vulnerable to: GHSA-4r4m-qw57-chr8","Warn: Project is vulnerable to: GHSA-xcj6-pq6g-qj4x","Warn: Project is vulnerable to: GHSA-356w-63v5-8wf4","Warn: Project is vulnerable to: GHSA-859w-5945-r5v3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T04:30:58.370Z","repository_id":36942491,"created_at":"2025-08-21T04:30:58.371Z","updated_at":"2025-08-21T04:30:58.371Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278929298,"owners_count":26070551,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["texture-mapping","texture-projection","threejs","threejs-example"],"created_at":"2024-08-01T07:01:30.634Z","updated_at":"2025-10-08T10:27:36.174Z","avatar_url":"https://github.com/marcofugaro.png","language":"JavaScript","funding_links":[],"categories":["Libraries"],"sub_categories":["JavaScript"],"readme":"# three-projected-material\n\n\u003e Three.js Material which lets you do [Texture Projection](https://en.wikipedia.org/wiki/Projective_texture_mapping) on a 3d Model.\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://marcofugaro.github.io/three-projected-material/\"\u003e\u003cimg src=\"screenshot.png\" width=\"700\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## Installation\n\nAfter having installed three.js, install it from npm with:\n\n```\nnpm install three-projected-material\n```\n\nor\n\n```\nyarn add three-projected-material\n```\n\nYou can also use it from the CDN, just make sure to use the three.js import map:\n\n```html\n\u003cscript type=\"importmap\"\u003e\n  {\n    \"imports\": {\n      \"three\": \"https://unpkg.com/three/build/three.module.js\"\n    }\n  }\n\u003c/script\u003e\n\u003cscript type=\"module\"\u003e\n  import ProjectedMaterial from 'https://unpkg.com/three-projected-material/build/ProjectedMaterial.module.js'\n  // ...\n\u003c/script\u003e\n```\n\n## Getting started\n\nYou can import it like this\n\n```js\nimport ProjectedMaterial from 'three-projected-material'\n```\n\nor, if you're using CommonJS\n\n```js\nconst ProjectedMaterial = require('three-projected-material').default\n```\n\nThen, you can use it like this:\n\n```js\nconst geometry = new THREE.BoxGeometry(1, 1, 1)\nconst material = new ProjectedMaterial({\n  camera, // the camera that acts as a projector\n  texture, // the texture being projected\n  textureScale: 0.8, // scale down the texture a bit\n  textureOffset: new THREE.Vector2(0.1, 0.1), // you can translate the texture if you want\n  cover: true, // enable background-size: cover behaviour, by default it's like background-size: contain\n  color: '#ccc', // the color of the object if it's not projected on\n  roughness: 0.3, // you can pass any other option that belongs to MeshPhysicalMaterial\n})\nconst box = new THREE.Mesh(geometry, material)\nwebgl.scene.add(box)\n\n// move the mesh any way you want!\nbox.rotation.y = -Math.PI / 4\n\n// and when you're ready project the texture on the box!\nmaterial.project(box)\n```\n\nProjectedMaterial also supports **instanced meshes** via three.js' [InstancedMesh](https://threejs.org/docs/index.html#api/en/objects/InstancedMesh), and even **multiple projections**. Check out the examples below for a detailed guide!\n\n## [Examples](https://marcofugaro.github.io/three-projected-material/)\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://marcofugaro.github.io/three-projected-material/basic\"\u003e\u003cimg width=\"274\" src=\"examples/screenshots/basic.png\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://marcofugaro.github.io/three-projected-material/same-camera\"\u003e\u003cimg width=\"274\" src=\"examples/screenshots/same-camera.png\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://marcofugaro.github.io/three-projected-material/3d-model\"\u003e\u003cimg width=\"274\" src=\"examples/screenshots/3d-model.png\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://marcofugaro.github.io/three-projected-material/orthographic-camera\"\u003e\u003cimg width=\"274\" src=\"examples/screenshots/orthographic-camera.png\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://marcofugaro.github.io/three-projected-material/transparency\"\u003e\u003cimg width=\"274\" src=\"examples/screenshots/transparency.png\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://marcofugaro.github.io/three-projected-material/envmap\"\u003e\u003cimg width=\"274\" src=\"examples/screenshots/envmap.png\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://marcofugaro.github.io/three-projected-material/multiple-projections\"\u003e\u003cimg width=\"274\" src=\"examples/screenshots/multiple-projections.png\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://marcofugaro.github.io/three-projected-material/instancing\"\u003e\u003cimg width=\"274\" src=\"examples/screenshots/instancing.png\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://marcofugaro.github.io/three-projected-material/multiple-projections-instancing\"\u003e\u003cimg width=\"274\" src=\"examples/screenshots/multiple-projections-instancing.png\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## API Reference\n\n### new ProjectedMaterial({ camera, texture, ...others })\n\nCreate a new material to later use for a mesh.\n\n| Option              | Default               | Description                                                                                                                                                                                                                                                                                                                                                                                     |\n| ------------------- | --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `camera`            |                       | The [PerspectiveCamera](https://threejs.org/docs/#api/en/cameras/PerspectiveCamera) the texture will be projected from.                                                                                                                                                                                                                                                                         |\n| `texture`           |                       | The [Texture](https://threejs.org/docs/#api/en/textures/Texture) being projected.                                                                                                                                                                                                                                                                                                               |\n| `textureScale`      | 1                     | Make the texture bigger or smaller.                                                                                                                                                                                                                                                                                                                                                             |\n| `textureOffset`     | `new THREE.Vector2()` | Offset the texture in a x or y direction. The unit system goes from 0 to 1, from the bottom left corner to the top right corner of the projector camera frustum.                                                                                                                                                                                                                                |\n| `cover`             | false                 | Wheter the texture should act like [`background-size: cover`](https://css-tricks.com/almanac/properties/b/background-size/) on the projector frustum. By default it works like [`background-size: contain`](https://css-tricks.com/almanac/properties/b/background-size/).                                                                                                                      |\n| `backgroundOpacity` | 1                     | The opacity of the part of the mesh which is not covered by the projected texture. You can set this to 0 if you don't want the non-projected part of the mesh to be shown.                                                                                                                                                                                                                      |\n| `...options`        |                       | Other options you pass to any three.js material like `color`, `opacity`, `envMap` and so on. The material is built from a [MeshPhysicalMaterial](https://threejs.org/docs/index.html#api/en/materials/MeshPhysicalMaterial), so you can pass any property of that material and of its parent [MeshStandardMaterial](https://threejs.org/docs/index.html#api/en/materials/MeshStandardMaterial). |\n\nThese properties are exposed as properties of the material, so you can change them later.\n\nFor example, to update the material texture and change its scale:\n\n```js\nmaterial.texture = newTexture\nmaterial.textureScale = 0.8\n```\n\n### material.project(mesh)\n\nProject the texture from the camera on the mesh. With this method we \"take a snaphot\" of the current mesh and camera position in space. The\nAfter calling this method, you can move the mesh or the camera freely.\n\n| Option | Description                                          |\n| ------ | ---------------------------------------------------- |\n| `mesh` | The mesh that has a `ProjectedMaterial` as material. |\n\n### allocateProjectionData(geometry, instancesCount)\n\nAllocate the data that will be used when projecting on an [InstancedMesh](https://threejs.org/docs/#api/en/objects/InstancedMesh). Use this on the geometry that will be used in pair with a `ProjectedMaterial` when initializing `InstancedMesh`.\n\nThis needs to be called before `.projectInstanceAt()`.\n\n| Option           | Description                                                                   |\n| ---------------- | ----------------------------------------------------------------------------- |\n| `geometry`       | The geometry that will be passed to the `InstancedMesh`.                      |\n| `instancesCount` | The number of instances, the same that will be passed to the `InstancedMesh`. |\n\n### material.projectInstanceAt(index, instancedMesh, matrix)\n\nDo the projection for an [InstancedMesh](https://threejs.org/docs/#api/en/objects/InstancedMesh). Don't forget to call `updateMatrix()` like you do before calling `InstancedMesh.setMatrixAt()`.\n\nTo do projection an an instanced mesh, the geometry needs to be prepared with `allocateProjectionData()` beforehand.\n\n```js\ndummy.updateMatrix()\nprojectInstanceAt(i, instancedMesh, dummy.matrix)\n```\n\n[Link to the full example about instancing](https://marcofugaro.github.io/three-projected-material/instancing).\n\n| Option          | Description                                                                                                              |\n| --------------- | ------------------------------------------------------------------------------------------------------------------------ |\n| `index`         | The index of the instanced element to project.                                                                           |\n| `instancedMesh` | The [InstancedMesh](https://threejs.org/docs/#api/en/objects/InstancedMesh) with a projected material.                   |\n| `matrix`        | The `matrix` of the dummy you used to position the instanced mesh element. Be sure to call `.updateMatrix()` beforehand. |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcofugaro%2Fthree-projected-material","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcofugaro%2Fthree-projected-material","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcofugaro%2Fthree-projected-material/lists"}