{"id":13731905,"url":"https://github.com/wwwtyro/glsl-atmosphere","last_synced_at":"2026-02-01T16:37:50.343Z","repository":{"id":66158537,"uuid":"49391597","full_name":"wwwtyro/glsl-atmosphere","owner":"wwwtyro","description":"Renders sky colors with Rayleigh and Mie scattering.","archived":false,"fork":false,"pushed_at":"2020-05-20T12:41:08.000Z","size":122,"stargazers_count":616,"open_issues_count":4,"forks_count":48,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-10-05T05:46:51.878Z","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":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wwwtyro.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}},"created_at":"2016-01-11T00:05:24.000Z","updated_at":"2025-10-01T13:32:27.000Z","dependencies_parsed_at":"2023-02-21T02:15:47.926Z","dependency_job_id":null,"html_url":"https://github.com/wwwtyro/glsl-atmosphere","commit_stats":{"total_commits":11,"total_committers":4,"mean_commits":2.75,"dds":0.2727272727272727,"last_synced_commit":"4f020921c496b6348663d2107dbe42c91b45df6f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wwwtyro/glsl-atmosphere","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wwwtyro%2Fglsl-atmosphere","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wwwtyro%2Fglsl-atmosphere/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wwwtyro%2Fglsl-atmosphere/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wwwtyro%2Fglsl-atmosphere/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wwwtyro","download_url":"https://codeload.github.com/wwwtyro/glsl-atmosphere/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wwwtyro%2Fglsl-atmosphere/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28983076,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T16:29:42.054Z","status":"ssl_error","status_checked_at":"2026-02-01T16:29:41.428Z","response_time":56,"last_error":"SSL_read: 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":[],"created_at":"2024-08-03T02:01:41.146Z","updated_at":"2026-02-01T16:37:50.318Z","avatar_url":"https://github.com/wwwtyro.png","language":"GLSL","funding_links":[],"categories":["Graphics"],"sub_categories":[],"readme":"# glsl-atmosphere\n\nRenders sky colors with Rayleigh and Mie scattering.\n\n\u003cp align='center'\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/wwwtyro/glsl-atmosphere/master/images/atmosphere.png\" width=\"100%\"\u003e\n\u003c/p\u003e\n\n[Demo](http://wwwtyro.github.io/glsl-atmosphere/)\n\n## Install\n\n```sh\nnpm install glsl-atmosphere\n```\n\n## Example\n\n### Javascript\n\n```js\nvar quad = Geometry(gl)\n    .attr('aPosition', [\n        -1, -1, -1,\n         1, -1, -1,\n         1,  1, -1,\n        -1, -1, -1,\n         1,  1, -1,\n        -1,  1, -1\n    ]);\n\nprogram.bind();\nquad.bind(program);\nprogram.uniforms.uSunPos = [0, 0.1, -1];\nquad.draw();\n```\n\n### Vertex Shader\n```glsl\nattribute vec3 aPosition;\n\nvarying vec3 vPosition;\n\nvoid main() {\n    gl_Position = vec4(aPosition, 1.0);\n    vPosition = aPosition;\n}\n```\n\n### Fragment Shader\n```glsl\nvarying vec3 vPosition;\n\nuniform vec3 uSunPos;\n\n#pragma glslify: atmosphere = require(glsl-atmosphere)\n\nvoid main() {\n    vec3 color = atmosphere(\n        normalize(vPosition),           // normalized ray direction\n        vec3(0,6372e3,0),               // ray origin\n        uSunPos,                        // position of the sun\n        22.0,                           // intensity of the sun\n        6371e3,                         // radius of the planet in meters\n        6471e3,                         // radius of the atmosphere in meters\n        vec3(5.5e-6, 13.0e-6, 22.4e-6), // Rayleigh scattering coefficient\n        21e-6,                          // Mie scattering coefficient\n        8e3,                            // Rayleigh scale height\n        1.2e3,                          // Mie scale height\n        0.758                           // Mie preferred scattering direction\n    );\n\n    // Apply exposure.\n    color = 1.0 - exp(-1.0 * color);\n\n    gl_FragColor = vec4(color, 1);\n}\n```\n\n## API\n```js\n#pragma glslify: atmosphere = require(glsl-atmosphere)\n```\n\n#### `vec3 atmosphere(vec3 r, vec3 r0, vec3 pSun, float iSun, float rPlanet, float rAtmos, vec3 kRlh, float kMie, float shRlh, float shMie, float g)`\n\nReturns a `vec3` representing the color of the sky along a view direction.\n\nTakes:\n\n* `vec3 r` normalized ray direction, typically a ray cast from the observers eye through a pixel\n* `vec3 r0` ray origin in meters, typically the position of the viewer's eye\n* `vec3 pSun` the position of the sun\n* `float iSun` intensity of the sun\n* `float rPlanet` radius of the planet in meters\n* `float rAtoms` radius of the atmosphere in meters\n* `vec3 kRlh` Rayleigh scattering coefficient\n* `vec3 kMie` Mie scattering coefficient\n* `float shRlh` Rayleigh scale height in meters\n* `float shMie` Mie scale height in meters\n* `float g` Mie preferred scattering direction\n\nFor an Earth-like atmosphere, see the settings in the example above.\n\n## Credits\n\n* [scratchapixel](https://www.scratchapixel.com/lessons/procedural-generation-virtual-worlds/simulating-sky)\n* [nvidia](https://developer.nvidia.com/gpugems/GPUGems2/gpugems2_chapter16.html)\n* [patapom](https://patapom.com/topics/Revision2013/Revision%202013%20-%20Real-time%20Volumetric%20Rendering%20Course%20Notes.pdf)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwwwtyro%2Fglsl-atmosphere","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwwwtyro%2Fglsl-atmosphere","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwwwtyro%2Fglsl-atmosphere/lists"}