{"id":18043730,"url":"https://github.com/roytheunissen/gpu-spline-deformation","last_synced_at":"2025-04-05T16:08:15.315Z","repository":{"id":55837471,"uuid":"265856658","full_name":"RoyTheunissen/GPU-Spline-Deformation","owner":"RoyTheunissen","description":"Baking spline deformation to a texture then applying it to a mesh via a shader.","archived":false,"fork":false,"pushed_at":"2024-11-18T09:33:32.000Z","size":4009,"stargazers_count":132,"open_issues_count":0,"forks_count":17,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-29T15:07:56.954Z","etag":null,"topics":["deformation","gpu","shader","shaders","spline","splines","unity"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RoyTheunissen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.MD","contributing":null,"funding":null,"license":"LICENSE.md","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":"2020-05-21T13:32:45.000Z","updated_at":"2025-03-28T06:39:51.000Z","dependencies_parsed_at":"2022-08-15T07:40:39.351Z","dependency_job_id":"0ab0e510-73c8-4891-babb-e0689315b421","html_url":"https://github.com/RoyTheunissen/GPU-Spline-Deformation","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RoyTheunissen%2FGPU-Spline-Deformation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RoyTheunissen%2FGPU-Spline-Deformation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RoyTheunissen%2FGPU-Spline-Deformation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RoyTheunissen%2FGPU-Spline-Deformation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RoyTheunissen","download_url":"https://codeload.github.com/RoyTheunissen/GPU-Spline-Deformation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247361690,"owners_count":20926643,"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":["deformation","gpu","shader","shaders","spline","splines","unity"],"created_at":"2024-10-30T17:09:37.392Z","updated_at":"2025-04-05T16:08:15.295Z","avatar_url":"https://github.com/RoyTheunissen.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Roy Theunissen](Documentation~/GithubHeader.jpg)](http://roytheunissen.com)\n[![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](LICENSE.md)\n![GitHub Follow](https://img.shields.io/github/followers/RoyTheunissen?label=RoyTheunissen\u0026style=social)\n\u003ca href=\"https://roytheunissen.com\" target=\"blank\"\u003e\u003cpicture\u003e\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://github.com/RoyTheunissen/RoyTheunissen/raw/master/globe_dark.png\"\u003e\n    \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://github.com/RoyTheunissen/RoyTheunissen/raw/master/globe_light.png\"\u003e\n    \u003cimg alt=\"globe\" src=\"globe_dark.png\" width=\"20\" height=\"20\" /\u003e\n\u003c/picture\u003e\u003c/a\u003e\n\u003ca href=\"https://bsky.app/profile/roytheunissen.com\" target=\"blank\"\u003e\u003cpicture\u003e\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://github.com/RoyTheunissen/RoyTheunissen/raw/master/bluesky_dark.png\"\u003e\n    \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://github.com/RoyTheunissen/RoyTheunissen/raw/master/bluesky_light.png\"\u003e\n    \u003cimg alt=\"bluesky\" src=\"bluesky_dark.png\" width=\"20\" height=\"20\" /\u003e\n\u003c/picture\u003e\u003c/a\u003e\n\u003ca href=\"https://www.youtube.com/c/r_m_theunissen\" target=\"blank\"\u003e\u003cpicture\u003e\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://github.com/RoyTheunissen/RoyTheunissen/raw/master/youtube_dark.png\"\u003e\n    \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://github.com/RoyTheunissen/RoyTheunissen/raw/master/youtube_light.png\"\u003e\n    \u003cimg alt=\"youtube\" src=\"youtube_dark.png\" width=\"20\" height=\"20\" /\u003e\n\u003c/picture\u003e\u003c/a\u003e \n\u003ca href=\"https://www.tiktok.com/@roy_theunissen\" target=\"blank\"\u003e\u003cpicture\u003e\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://github.com/RoyTheunissen/RoyTheunissen/raw/master/tiktok_dark.png\"\u003e\n    \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://github.com/RoyTheunissen/RoyTheunissen/raw/master/tiktok_light.png\"\u003e\n    \u003cimg alt=\"tiktok\" src=\"tiktok_dark.png\" width=\"20\" height=\"20\" /\u003e\n\u003c/picture\u003e\u003c/a\u003e\n\n_Sample for baking deformation to a texture then applying it to a mesh via a shader._\n\n## About the Project\n\nI saw [Simon Trümpler's Tileable Liquid Mesh on Spline](https://www.artstation.com/artwork/BmN5G6) and I was wondering how the mesh was following the spline exactly. It gave me the idea of baking the deformation to a texture somehow, which actually turned out to be really simple.\n\n[Video](https://youtu.be/bfY7kJfgMuc)    |    [Article](https://medium.com/@roy.theunissen/gpu-spline-deformation-in-unity-a710f55f210c)\n\n![Example](Documentation~/Example.gif)\n\n## Getting Started\n\n- Add the package to your Unity project (tips on how to install it are in the Installation section)\n- Create the mesh you will be deforming that's pointing in the forward Z axis. Samples are provided.\n  - Make sure it has a material with the `Deformation Lookup Shader` shader.\n  - If the mesh does not start at (0, 0, 0) and stop at (0, 0, 1), adjust the `Z Start` and `Z End` properties accordingly.\n- Implement the `IDeformationProvider` interface in the script that is responsible for the deformation that you want to bake or use the provided `BezierSpline` script.\n- Add a `DeformationTextureRenderer` script to the scene. I recommend adding it next to the mesh you'll be deforming.\n- Assign the script responsible for the deformation to the Deformation Provider field.\n  - Assign the material for the mesh that will be deformed (this is necessary for assigning it dynamically created textures)\n- You should now see the mesh deform along whatever deformation is provided via the script.\n\n## Troubleshooting\n- If the mesh is not deforming, check that `Amount` is set to 1 in the material. This feature exists for quickly toggling the effect on and off to see what it does.\n- If the mesh is not deforming, check that it has the right material, shader and texture assigned\n- Make sure the correct texture asset and/or material are assigned in the Deformation Texture Renderer\n- If you are seeing artifacts or incorrect deformation:\n  - Make sure the resolution is sufficiently large. Set the mode to Dynamic and try out larger resolutions until the artifacts disappear\n  - Make sure `Z Start` and `Z End` are set correctly in the material\n  - Make sure the texture's wrap mode is set to clamp. For looping meshes you may want the X-axis to be set to Repeat\n\n## Installation\n\n### Package Manager\n\nGo to `Edit \u003e Project Settings \u003e Package Manager`. Under 'Scoped Registries' make sure there is an OpenUPM entry.\n\nIf you don't have one: click the `+` button and enter the following values:\n\n- Name: `OpenUPM` \u003cbr /\u003e\n- URL: `https://package.openupm.com` \u003cbr /\u003e\n\nThen under 'Scope(s)' press the `+` button and add `com.roytheunissen`.\n\nIt should look something like this: \u003cbr /\u003e\n![image](https://user-images.githubusercontent.com/3997055/185363839-37b3bb3d-f70c-4dbd-b30d-cc8a93b592bb.png)\n\n\u003cbr /\u003e\nAll of my packages will now be available to you in the Package Manager in the 'My Registries' section and can be installed from there.\n\u003cbr /\u003e\n\n\n### Git Submodule\n\nYou can check out this repository as a submodule into your project's Assets folder. This is recommended if you intend to contribute to the repository yourself\n\n### OpenUPM\nThe package is available on the [openupm registry](https://openupm.com). It's recommended to install it via [openupm-cli](https://github.com/openupm/openupm-cli).\n\n```\nopenupm add com.roytheunissen.gpusplinedeformation\n```\n\n### Manifest\nYou can also install via git URL by adding this entry in your **manifest.json**\n```\n\"com.roytheunissen.gpusplinedeformation\": \"https://github.com/RoyTheunissen/GPU-Spline-Deformation.git\"\n```\n\n### Unity Package Manager\n```\nfrom Window-\u003ePackage Manager, click on the + sign and Add from git: https://github.com/RoyTheunissen/GPU-Spline-Deformation.git\n```\n\n\n## Contact\n[Roy Theunissen](https://roytheunissen.com)\n\n[roy.theunissen@live.nl](mailto:roy.theunissen@live.nl)\n\n\n## Acknowledgements\n* [Tileable Liquid Mesh on Spline, Simon Trümpler](https://www.artstation.com/artwork/BmN5G6) for the inspiration\n* [Curves and Splines, Catlike Coding](https://catlikecoding.com/unity/tutorials/curves-and-splines/) for the spline implementation\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froytheunissen%2Fgpu-spline-deformation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froytheunissen%2Fgpu-spline-deformation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froytheunissen%2Fgpu-spline-deformation/lists"}