{"id":13663105,"url":"https://github.com/adcimon/bounce-effect","last_synced_at":"2026-06-22T21:01:44.819Z","repository":{"id":133922909,"uuid":"176547393","full_name":"adcimon/bounce-effect","owner":"adcimon","description":"Vertex shader that creates a bounce effect in geometry.","archived":false,"fork":false,"pushed_at":"2024-06-02T17:43:04.000Z","size":13081,"stargazers_count":25,"open_issues_count":0,"forks_count":5,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-03-07T03:43:44.914Z","etag":null,"topics":["shaders","unity"],"latest_commit_sha":null,"homepage":"","language":"C#","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/adcimon.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-03-19T15:48:29.000Z","updated_at":"2026-01-19T07:29:16.000Z","dependencies_parsed_at":"2024-11-10T19:41:45.178Z","dependency_job_id":null,"html_url":"https://github.com/adcimon/bounce-effect","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/adcimon/bounce-effect","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adcimon%2Fbounce-effect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adcimon%2Fbounce-effect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adcimon%2Fbounce-effect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adcimon%2Fbounce-effect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adcimon","download_url":"https://codeload.github.com/adcimon/bounce-effect/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adcimon%2Fbounce-effect/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34665261,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-22T02:00:06.391Z","response_time":106,"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":["shaders","unity"],"created_at":"2024-08-02T05:02:17.865Z","updated_at":"2026-06-22T21:01:44.774Z","avatar_url":"https://github.com/adcimon.png","language":"C#","funding_links":[],"categories":["C\\#"],"sub_categories":[],"readme":"# Bounce Effect\n\nVertex shader that creates a bounce effect in geometry.\n\n\u003cp align=\"center\"\u003e\n\t\u003cimg align=\"center\" src=\"example.gif\" title=\"My goods are the highest quality\"\u003e\u003cbr\u003e\n\u003c/p\u003e\n\nAt GDC 2013, Jonathan Lindquist from Epic Games did a \u003ca href=\"https://www.youtube.com/watch?v=7Fl3so0Z5Tc\"\u003etalk\u003c/a\u003e about Fornite's procedural animations. These animations were based on vertex displacements using vertex shaders. The main goal of these animations was to make hitting and destroying things fun. The technique used to create the bounce effect is simple, elegant and the final result is very engaging.\n\nThe first thing needed is the impact position on the object. In this example a ray is casted from the camera to the scene and checks if the gameobject hit has an `BounceReceiver` component.\n```\nRay ray = Camera.main.ScreenPointToRay(Input.mousePosition);\n\nRaycastHit hit;\nif (Physics.Raycast(ray, out hit))\n{\n\tBounceReceiver receiver = hit.transform.GetComponent\u003cBounceReceiver\u003e();\n\tif (receiver)\n\t{\n\t\treceiver.Impact(hit.point, ray.direction);\n\t}\n}\n```\n\nThen, the `BounceReceiver` sets the material properties that the shader is going to use.\n\u003cul\u003e\n\t\u003cli\u003e\u003cstrong\u003e_TargetPosition\u003c/strong\u003e. Position of the bounce in world space.\u003c/li\u003e\n\t\u003cli\u003e\u003cstrong\u003e_Direction\u003c/strong\u003e. Direction of the bounce.\u003c/li\u003e\n\t\u003cli\u003e\u003cstrong\u003e_Radius\u003c/strong\u003e. Radius of the bounce.\u003c/li\u003e\n\t\u003cli\u003e\u003cstrong\u003e_Amplitude\u003c/strong\u003e. Amplitude of the bounce.\u003c/li\u003e\n\t\u003cli\u003e\u003cstrong\u003e_Value\u003c/strong\u003e. Value from 0 to 1 used to animate, evaluated using an \u003ca href=\"https://docs.unity3d.com/ScriptReference/AnimationCurve.html\"\u003eAnimationCurve\u003c/a\u003e.\u003c/li\u003e\n\t\u003cli\u003e\u003cstrong\u003e_Bounce\u003c/strong\u003e. Boolean flag used to play and stop the animation.\u003c/li\u003e\n\u003c/ul\u003e\n\n```\nmaterial.SetVector(\"_TargetPosition\", position);\nmaterial.SetVector(\"_Direction\", direction);\nmaterial.SetFloat(\"_Radius\", radius);\nmaterial.SetFloat(\"_Amplitude\", amplitude);\nmaterial.SetFloat(\"_Value\", curve.Evaluate(currentTime / totalTime));\nmaterial.SetInt(\"_Bounce\", 1);\ncurrentTime = 0;\nisAnimating = true;\n```\n\nWhen the animation is playing the `_Value` is updated every frame in the `Update` method.\n```\ncurrentTime += Time.deltaTime;\nmaterial.SetFloat(\"_Value\", curve.Evaluate(currentTime / totalTime));\n```\n\nIn the shadergraph a distance value is calculated from the vertex position in object space to the `TargetPosition` (transformed from world space to object space). This distance is divided by the `Radius`, clamped (between 0 and 1) and the result is substracted from 1. Then this result is multiplied by the `Direction` * `Amplitude` * `Value` (the offset in the normal direction at the given animation time). The next step is to add this value to the vertex position in object space and lastly the boolean flag `Bounce` is checked to output the final result (or the vertex position not displaced) to the position input of the main node.\n\u003cp align=\"center\"\u003e\n\t\u003cimg align=\"center\" src=\"shadergraph.jpg\"\u003e\u003cbr\u003e\n\u003c/p\u003e\n\nReferences.\n\u003e \u003ca href=\"https://www.gdcvault.com/play/1018192/The-Inner-Workings-of-Fortnite\"\u003eThe Inner Workings of Fornite's Shader-Based Procedural Animations\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadcimon%2Fbounce-effect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadcimon%2Fbounce-effect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadcimon%2Fbounce-effect/lists"}