{"id":18020047,"url":"https://github.com/polygonjs/polygonjs-threejs-raymarching-example","last_synced_at":"2026-02-13T10:11:38.194Z","repository":{"id":109051206,"uuid":"556464356","full_name":"polygonjs/polygonjs-threejs-raymarching-example","owner":"polygonjs","description":"Example repository to show how to add raymarching materials created with Polygonjs to Threejs","archived":false,"fork":false,"pushed_at":"2022-10-24T14:02:30.000Z","size":6712,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-23T12:37:25.679Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"GLSL","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/polygonjs.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,"governance":null}},"created_at":"2022-10-23T22:48:54.000Z","updated_at":"2025-03-23T23:07:51.000Z","dependencies_parsed_at":"2023-03-12T11:31:16.625Z","dependency_job_id":null,"html_url":"https://github.com/polygonjs/polygonjs-threejs-raymarching-example","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"58bb8ce812b91c861f9dcaa43970494a272b9cd2"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/polygonjs/polygonjs-threejs-raymarching-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polygonjs%2Fpolygonjs-threejs-raymarching-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polygonjs%2Fpolygonjs-threejs-raymarching-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polygonjs%2Fpolygonjs-threejs-raymarching-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polygonjs%2Fpolygonjs-threejs-raymarching-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/polygonjs","download_url":"https://codeload.github.com/polygonjs/polygonjs-threejs-raymarching-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polygonjs%2Fpolygonjs-threejs-raymarching-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272262430,"owners_count":24902646,"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-08-26T02:00:07.904Z","response_time":60,"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":[],"created_at":"2024-10-30T05:13:24.307Z","updated_at":"2026-02-13T10:11:33.164Z","avatar_url":"https://github.com/polygonjs.png","language":"GLSL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Raymarching + Threejs\n\nThis repo demonstrates how to add raymarching materials created with [Polygonjs](https://polygonjs.com) to any threejs scene. See [live example](https://polygonjs.com/demo?example=bynode/mat/raymarchingbuilder/refractions)\n\n![Raymarching_with_threejs](https://github.com/polygonjs/polygonjs-threejs-raymarching-example/blob/main/assets/refraction_threejs.gif?raw=true)\n\nIf you do not know anything about Polygonjs, learn first [how to create your first scene](https://polygonjs.com/docs/getting_started).\n\nAssuming you have saved a scene called `scene_01`, all you need to add are those 2 snippets:\n\nThis imports your polygonjs scene and adds it to the threejs scene:\n\n``` ts\n// 1. import the polygonjs scene\nimport { fetchSceneAndMount_scene_01 } from './polygonjs/scenes/scene_01/autogenerated/fetchSceneAndMount';\nimport { PolySceneWithNodeMap_scene_01 } from './polygonjs/scenes/scene_01/autogenerated/PolySceneWithNodeMap';\nlet polygonjsScene: PolySceneWithNodeMap_scene_01|undefined;\nfetchSceneAndMount_scene_01({\n  createViewer:false, // we do not create a polygonjs viewer here, since we use threejs WebGLRenderer\n  autoPlay:true // we play the scene after it is loaded\n}).then(loadedData=\u003e{\n  polygonjsScene = loadedData.scene;\n  // 2. add the threejs scene created by polygonjs to our original threejs scene\n  scene.add(polygonjsScene.threejsScene());\n})\n```\n\nAnd make sure to run `.update(delta)` in the render loop:\n\n``` ts\nconst renderState = {scene}; // create a renderState, which is a simple container for the scene\nconst clock = new THREE.Clock(); // create a clock\nfunction animation( time:number ) {\n  const delta = clock.getDelta();\n  \n  // pass the delta and render state to PolyScene.update() method\n  polygonjsScene?.update(delta, renderState);\n\n  renderer.render( scene, camera );\n}\n\n```\n\n# Open Polygonjs Editor\n\n- 1: install dependencies, with `yarn` or `npm install`\n- 2: run: `yarn polygon` or `npm run polygon`\n- 3: open your browser on `http://localhost:8091`\n\nIf you have any trouble installing it, the docs may be able to help: [https://polygonjs.com/docs/](https://polygonjs.com/docs/)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolygonjs%2Fpolygonjs-threejs-raymarching-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolygonjs%2Fpolygonjs-threejs-raymarching-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolygonjs%2Fpolygonjs-threejs-raymarching-example/lists"}