{"id":28042286,"url":"https://github.com/xjine/unity_pingpongpattern","last_synced_at":"2026-05-15T01:32:27.139Z","repository":{"id":291032587,"uuid":"974677262","full_name":"XJINE/Unity_PingPongPattern","owner":"XJINE","description":"\"Ping Pong Pattern\" is a useful pattern for representing spatial areas, such as national borders or habitats.","archived":false,"fork":false,"pushed_at":"2025-05-02T01:42:36.000Z","size":1840,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-02T02:34:54.768Z","etag":null,"topics":["assets","noise","unity"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/XJINE.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,"zenodo":null}},"created_at":"2025-04-29T06:26:04.000Z","updated_at":"2025-05-02T01:43:59.000Z","dependencies_parsed_at":"2025-05-02T02:45:08.549Z","dependency_job_id":null,"html_url":"https://github.com/XJINE/Unity_PingPongPattern","commit_stats":null,"previous_names":["xjine/unity_pingpongpattern"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XJINE%2FUnity_PingPongPattern","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XJINE%2FUnity_PingPongPattern/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XJINE%2FUnity_PingPongPattern/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XJINE%2FUnity_PingPongPattern/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/XJINE","download_url":"https://codeload.github.com/XJINE/Unity_PingPongPattern/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253578458,"owners_count":21930554,"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":["assets","noise","unity"],"created_at":"2025-05-11T14:25:20.225Z","updated_at":"2026-05-15T01:32:27.127Z","avatar_url":"https://github.com/XJINE.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Unity_PingPongPattern\n\n\u003ctable style=\"width: 100%; border: none;\"\u003e\u003ctr\u003e\n\u003ctd style=\"width: 25%;\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/XJINE/Unity_PingPongPattern/main/Screenshot01.gif\"\u003e\u003c/td\u003e\n\u003ctd style=\"width: 25%;\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/XJINE/Unity_PingPongPattern/main/Screenshot02.gif\"\u003e\u003c/td\u003e\n\u003ctd style=\"width: 25%;\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/XJINE/Unity_PingPongPattern/main/Screenshot03.gif\"\u003e\u003c/td\u003e\n\u003ctd style=\"width: 25%;\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/XJINE/Unity_PingPongPattern/main/Screenshot04.gif\"\u003e\u003c/td\u003e\n\u003c/tr\u003e\u003c/table\u003e\n\n\"Ping Pong Pattern\" is a useful pattern for representing spatial areas, such as national borders or habitats.\nThe area continuously changes due to seeds bouncing like a \"Ping-Pong\" inside it.\n\nThis isn't a completely original idea. You'll find plenty of others who have come up with similar algorithm.\n\n\u003cimg src=\"https://github.com/XJINE/Unity_PingPongPattern/blob/main/Screenshot.png\" width=\"100%\" height=\"auto\" /\u003e\n\n## Discussion\n\n### Reflection\n\n```csharp\nfloat2 fakeNormal = normalize(seed.coord * texSize - sampleCoord + randomNormal);\nseed.velocity = reflect(seed.velocity, fakeNormal);\n```\n\nI considered using the vector between the seed and the hit pixel as the normal vector.\n(Of course, a bit of randomness is added to that.)\n\nThis approach produces poor results. It tends to be very stable, with little variation.\n\n```csharp\nfloat2 randomNormal = normalize(float2(random(seed.velocity * RandomSeed) - 0.5,\n                                       random(seed.coord    * RandomSeed) - 0.5));\nseed.velocity = reflect(seed.velocity, randomNormal);\n```\n\nTo make the changes more dynamic, the reflections should be completely random.\n\nIf stable results are required, it is better to use something like Voronoi.\n\n### Distinction\n\nAs you can see, the result is more organic than expected.\n\nWhat sets it apart from typical noise like patterns is its ability to maintain continuity, even when the number of seeds or parameters changes.\n\nHowever, this algorithm has no periodicity like typical noise, nor reproducibility.\n\nIt is only known that seeds with the same parameters create similar areas.\nThe sizes and movement speeds of each area tend to yield similar results, but the overall result cannot be controlled.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxjine%2Funity_pingpongpattern","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxjine%2Funity_pingpongpattern","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxjine%2Funity_pingpongpattern/lists"}