{"id":48573719,"url":"https://github.com/schmelczer/sdf-2d","last_synced_at":"2026-04-08T15:35:40.511Z","repository":{"id":45011126,"uuid":"296137428","full_name":"schmelczer/sdf-2d","owner":"schmelczer","description":"A graphics library to enable the real-time rendering of 2D signed distance fields on the web.","archived":false,"fork":false,"pushed_at":"2022-01-29T20:22:25.000Z","size":9018,"stargazers_count":115,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-30T11:22:34.370Z","etag":null,"topics":["2d","circle-tracing","glsl","graphics-library","raytracing","sdf-2d","typescript","webgl","webgl2","webpack"],"latest_commit_sha":null,"homepage":"http://schmelczer.dev/sdf-2d/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/schmelczer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-16T20:10:53.000Z","updated_at":"2025-09-23T04:58:12.000Z","dependencies_parsed_at":"2022-09-22T15:51:33.508Z","dependency_job_id":null,"html_url":"https://github.com/schmelczer/sdf-2d","commit_stats":null,"previous_names":["schmelczerandras/sdf-2d"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/schmelczer/sdf-2d","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schmelczer%2Fsdf-2d","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schmelczer%2Fsdf-2d/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schmelczer%2Fsdf-2d/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schmelczer%2Fsdf-2d/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/schmelczer","download_url":"https://codeload.github.com/schmelczer/sdf-2d/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schmelczer%2Fsdf-2d/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31562692,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["2d","circle-tracing","glsl","graphics-library","raytracing","sdf-2d","typescript","webgl","webgl2","webpack"],"created_at":"2026-04-08T15:35:39.932Z","updated_at":"2026-04-08T15:35:40.500Z","avatar_url":"https://github.com/schmelczer.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ![SDF-2D logo](media/logo-colored.svg) SDF-2D library\n\nA graphics library to enable the real-time rendering of 2D signed distance fields on the web.\n\n![screenshot of a bumpy tunnel](media/tunnels-screenshot.png)\n\n![screenshot of merging circles](media/circles-screenshot.png)\n\n## Links\n\n- [View it in action (demos)](https://sdf2d.schmelczer.dev)\n- [View it in action (video game)](https://decla.red)\n- [Documentation](https://schmelczerandras.github.io/sdf-2d/)\n- [In-depth information](https://github.com/schmelczerandras/sdf-2d/blob/master/media/thesis-andras-schmelczer.pdf)\n\n## Features\n\n- Works with both WebGL and WebGL2\n  \u003e The former is mostly required for supporting iPhones.\n- Performant even on low-end mobile devices\n  \u003e Try it out yourself!\n- Has a number of built-in shapes and lights\n- Easily extensible with new shapes\n- Antialiasing is implemented\n- Has built-in quality autoscaling\n- Requires no boilerplate code\n  - Automatic detection of WebGL and its extensions is provided\n  - Parallel, non-blocking shader compiling\n  - Context lost is handled with automatic restoration\n  - Can be used without thinking of the GPU _(although for stunning results it, should be kept in mind)_\n\n![four screenshots from mobiles](media/mobile-screenshots.png)\n\n\u003e Four separate screenshots taken on a mobile device\n\n## Install\n\n```sh\nnpm install sdf-2d --save-dev\n```\n\n## Use\n\n```js\nimport { compile, CircleFactory, hsl, CircleLight } from 'sdf-2d';\n\nconst main = async () =\u003e {\n  const Circle = CircleFactory(hsl(30, 66, 50));\n  const canvas = document.querySelector('canvas');\n\n  const renderer = await compile(canvas, [Circle.descriptor, CircleLight.descriptor]);\n\n  renderer.addDrawable(new Circle([200, 200], 50));\n  renderer.addDrawable(new CircleLight([500, 300], [1, 0.5, 0], 0.5));\n  renderer.renderDrawables();\n};\n\nmain();\n```\n\n\u003e A commented version of the above code can be found [in this repo](https://github.com/schmelczerandras/sdf-2d-minimal-example).\n\n## Examples\n\nFor further examples, please visit the following repositories:\n\n- [Minimal example (using Webpack)](https://github.com/schmelczerandras/sdf-2d-minimal-example)\n- [More complex example](https://github.com/schmelczerandras/sdf-2d-minimal-example)\n- [Source for the demo page](https://github.com/schmelczerandras/sdf-2d-demo)\n- [Source for decla.red, the multiplayer game](https://github.com/schmelczerandras/decla.red)\n\n## Documentation\n\nFor more technical details, please consult the documentation available in the repository and at [schmelczerandras.github.io/sdf-2d/](https://schmelczerandras.github.io/sdf-2d/).\n\n## Plans\n\n- Automatic tile multiplier scaling\n- Non-uniform tile sizes based on scene density\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschmelczer%2Fsdf-2d","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fschmelczer%2Fsdf-2d","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschmelczer%2Fsdf-2d/lists"}