{"id":20687181,"url":"https://github.com/gilbertocunha/atmospheric-scattering","last_synced_at":"2025-10-09T03:17:18.210Z","repository":{"id":111972685,"uuid":"226888988","full_name":"GilbertoCunha/Atmospheric-Scattering","owner":"GilbertoCunha","description":"An algorithm that calculates images of the sky based on light scattering phenomena","archived":false,"fork":false,"pushed_at":"2020-10-12T09:55:43.000Z","size":3161,"stargazers_count":17,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-09T03:17:17.291Z","etag":null,"topics":["image-generation","physics","python3","sky","sky-color-calculation"],"latest_commit_sha":null,"homepage":"","language":"Python","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/GilbertoCunha.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-12-09T14:19:16.000Z","updated_at":"2024-05-25T12:40:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"c7b89a9b-f6a0-4f42-ad85-866b4184ece9","html_url":"https://github.com/GilbertoCunha/Atmospheric-Scattering","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GilbertoCunha/Atmospheric-Scattering","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GilbertoCunha%2FAtmospheric-Scattering","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GilbertoCunha%2FAtmospheric-Scattering/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GilbertoCunha%2FAtmospheric-Scattering/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GilbertoCunha%2FAtmospheric-Scattering/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GilbertoCunha","download_url":"https://codeload.github.com/GilbertoCunha/Atmospheric-Scattering/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GilbertoCunha%2FAtmospheric-Scattering/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000732,"owners_count":26082911,"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-10-09T02:00:07.460Z","response_time":59,"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":["image-generation","physics","python3","sky","sky-color-calculation"],"created_at":"2024-11-16T22:56:20.012Z","updated_at":"2025-10-09T03:17:18.205Z","avatar_url":"https://github.com/GilbertoCunha.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# The Physics of the color of the sky: Atmospheric Light Scattering\nThis repository is the final project that I developed for a \nComputational Physics class at University of Minho. It is a Python \nalgorithm that calculates the color of the sky using light scattering \nphysics, more specifically both Rayleigh and Mie scattering.\n\nIt can calculate how the sunset looks:\n![Sky](Images/sky.png \"Sky color calculation\")\n\nOr maybe you want to look at the sky at around midday:\n![Sky](Images/NewSky.png \"Sky color calculation\")\n\nOr any other direction you want. You can even change the values of the \nearth's atmosphere to see how it would look like in a particular scenario.\n\n# How to navigate through the code\nI subdivided the code in 4 files under the folder Code:\n\n1. Vector.py: A file that contains a Vector class with some useful \nproperties to make the development of the main algorithm simpler.\n2. Algorithm.py: Where the main algorithm is. It contains a function \nthat calculates the intensity of a certain color for one pixel and some\nauxiliary functions to help out in this process.\n3. Aux.py: This file contains an auxiliary function to calculate the \nshooting direction Vectors for each pixel in the image plane.\n4. MakeImage.py: This is where you will be able to generate the images. \nIt calculates the color of each pixel for each RGB channel producing \nan image at the end. Is is also a parallelization of the code of \nAlgorithm.py to make calculations faster, even though they will still\ntake some time.\n\n# The Vector class\nThe vector class is just that, a class that represents vectors. \nI also use it to represent directions as unit vectors. It supports \nboth cartesian and spherical coordinates, since these two coordinate \nsystems are very useful for the development of this project. To create \na vector object, you simply do the following:\n\nvector = Vector(first_coordinate,\n                second_coordinate,\n                third_coordinate,\n                coordinate_type)\n                \nCoordinate type can be either 'cart' or 'sph' representing the two\nsupported coordinate systems.\n\nFor the cartesian system the three coordinates are, respectively, x, y \nand z. For the spherical coordinates they are the distance to the origin,\nthe azimuthal and the polar angle, respectively.\n\nThis class also includes some useful methods for vector operations.\n\n# How to generate images\nFirst go to the MakeImage.py file under the Code folder. In there you\nwill see many variables. These are the main ones that will help you \nplay around and produce some nice results:\n\n- direction: The viewing direction of the observer\n- sun_direction: The direction of the sun\n- fov: The field of view of the observer\n- width and length: number of rows and columns of pixels, respectively.\nSince for now the program only supports square images, you should give\nboth of them the same value\n\nYou can then produce images with two simples steps:\n\n1. Modify desired variables in MakeImage.py\n2. Run MakeImage.py\n\nSince calculating large images is time\nconsuming, you usually should preview it \nfirst with, say, 100x100 pixels to see what\nto expect and then produce the final image.\n\nNote: If you want to play around with the position of the observer, \nyou might have to change the exposure of the image to be able to \nsee it clearly.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgilbertocunha%2Fatmospheric-scattering","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgilbertocunha%2Fatmospheric-scattering","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgilbertocunha%2Fatmospheric-scattering/lists"}