{"id":22446861,"url":"https://github.com/ppmpreetham/osl-shaders","last_synced_at":"2025-10-29T06:14:30.487Z","repository":{"id":226383202,"uuid":"768515388","full_name":"ppmpreetham/OSL-Shaders","owner":"ppmpreetham","description":"🎃 Rewriting all the nodes in blender through OSL","archived":false,"fork":false,"pushed_at":"2025-07-23T18:06:01.000Z","size":12,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-29T20:40:47.942Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ppmpreetham.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":"2024-03-07T08:22:46.000Z","updated_at":"2025-07-28T16:24:51.000Z","dependencies_parsed_at":"2024-04-08T08:25:39.011Z","dependency_job_id":"f30c6fdb-8146-4be8-ad24-a6119d6af245","html_url":"https://github.com/ppmpreetham/OSL-Shaders","commit_stats":null,"previous_names":["preetham-ai/osl-shaders","ppmpreetham/osl-shaders"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ppmpreetham/OSL-Shaders","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppmpreetham%2FOSL-Shaders","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppmpreetham%2FOSL-Shaders/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppmpreetham%2FOSL-Shaders/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppmpreetham%2FOSL-Shaders/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ppmpreetham","download_url":"https://codeload.github.com/ppmpreetham/OSL-Shaders/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppmpreetham%2FOSL-Shaders/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281571631,"owners_count":26524052,"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-29T02:00:06.901Z","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":[],"created_at":"2024-12-06T04:12:23.623Z","updated_at":"2025-10-29T06:14:30.446Z","avatar_url":"https://github.com/ppmpreetham.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# OSL-Shaders\nAn attempt to recreate the nodes in blender using OSL\n\n## Mix nodes\n\nThis makes use of `Linear Interpolation (LERP)` to mix two values together. The mix factor $t$ is used to determine how much of each value to take.\nFor an example, in math, if we want to mix two functions $f(x)$ and $g(x)$, we usually do it by taking a mix factor $t$, and the output is going to be a new function $h(x) = tf(x)+(1-t)g(x)$. Here, $0\\lt t\\lt 1$.\n\n![2 functions](https://github.com/Preetham-ai/OSL-Shaders/assets/75422607/6e09eb74-0e7a-4494-b296-d4703f20689b)\n\n## Texture Coordinate Node\n\nThe Texture coordinate node provides the:\n\n- Object\n- Normal\n- UV\n- Incident\n- Reflection\n\n### Reflection Node\n\nWe can use this formula to derive the reflection node using the incident node.\n\n$\\mathbf{r} = \\mathbf{i} - 2 \\mathbf{n}(\\mathbf{n} \\cdot \\mathbf{i})$\n\n## RGB to BW Node\n\nTook the cofiguration of the OpenColorIO on the luma line in https://git.blender.org/gitweb/gitweb.cgi/blender.git/blob_plain/HEAD:/release/datafiles/colormanagement/config.ocio.\n\nThis is the same as taking the dot product between ```R,G,B``` and ```0.2126,0.7152,0.0722```. This would yield us a result in a greyscale mode in which all the R,G,B channels are given the color $0.2126*R + 0.7152*G + 0.0722*B$.\n\n## Blackbody Shader\n\nThis doesn't look like the Blender's Blackbody node but produces quite similar results.\n\nAccording to the [Stefan-Boltzmann law](https://en.wikipedia.org/wiki/Stefan%E2%80%93Boltzmann_law), hotter objects emit more high-frequency radiation compared to cooler objects. As blue light has a higher frequency than red light, hot objects tend to emit bluish light, warm objects emit white light (a combination of blue and red), and cool objects emit red light.\n\nUsed the algorithm by [Tanner Helland](https://tannerhelland.com/2012/09/18/convert-temperature-rgb-algorithm-code.html)\n\n## MapRange Node\n### Linear Interpolation (LERP)\nThis makes use of the linear interpolation formula to map a value from one range to another. The formula is as follows:\n\n$$\n\\text{Result} = \\text{ToMin} + \\left(\\frac{x - \\text{FromMin}}{\\text{FromMax} - \\text{FromMin}}\\right) \\times (\\text{ToMax} - \\text{ToMin})\n$$\n\nWhere:\n\n* `x` is the input\n* `FromMin` and `FromMax` define the **original** range\n* `ToMin` and `ToMax` define the **new** target range\n* Result is the mapped value","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fppmpreetham%2Fosl-shaders","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fppmpreetham%2Fosl-shaders","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fppmpreetham%2Fosl-shaders/lists"}