{"id":15014854,"url":"https://github.com/ladysnake/satin","last_synced_at":"2025-04-05T05:07:35.867Z","repository":{"id":40587602,"uuid":"172801168","full_name":"Ladysnake/Satin","owner":"Ladysnake","description":"A Fabric library to help with shader usage","archived":false,"fork":false,"pushed_at":"2025-02-28T18:40:37.000Z","size":704,"stargazers_count":111,"open_issues_count":6,"forks_count":30,"subscribers_count":1,"default_branch":"1.21","last_synced_at":"2025-04-05T05:07:28.474Z","etag":null,"topics":["fabricmc","fabricmc-mod","hacktoberfest","library","minecraft","shaders"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ladysnake.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","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}},"created_at":"2019-02-26T22:32:52.000Z","updated_at":"2025-04-03T14:18:13.000Z","dependencies_parsed_at":"2023-12-05T22:31:06.225Z","dependency_job_id":"c42b5af4-14b4-4cb2-a2f3-f2925e8c66bc","html_url":"https://github.com/Ladysnake/Satin","commit_stats":{"total_commits":231,"total_committers":13,"mean_commits":17.76923076923077,"dds":0.1471861471861472,"last_synced_commit":"660ab57174647cfbc6575d1c90081dc96a4784c5"},"previous_names":[],"tags_count":51,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ladysnake%2FSatin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ladysnake%2FSatin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ladysnake%2FSatin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ladysnake%2FSatin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ladysnake","download_url":"https://codeload.github.com/Ladysnake/Satin/tar.gz/refs/heads/1.21","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247289428,"owners_count":20914464,"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","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":["fabricmc","fabricmc-mod","hacktoberfest","library","minecraft","shaders"],"created_at":"2024-09-24T19:46:10.664Z","updated_at":"2025-04-05T05:07:35.847Z","avatar_url":"https://github.com/Ladysnake.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Satin\n\n[![](https://jitpack.io/v/Ladysnake/Satin.svg)](https://jitpack.io/#Ladysnake/Satin)\n\nA lightweight Fabric library for OpenGL shader usage.\n\n---\n\n## Adding Satin to your project\n\nYou can add the library by inserting the following in your `build.gradle` (Requires Loom 0.2.4+):\n\n**Note 1: since MC 1.17 builds, the Satin dependency must be lowercase.**  \n**Note 2: since MC 1.20.1 builds (1.14.0), the maven group changed from `io.github.ladysnake` to `org.ladysnake`.**  \n**Note 3: since June 2023, the maven url changed from `ladysnake.jfrog.io/artifactory/mods` to `maven.ladysnake.org/releases`.**  \n\n```gradle\nrepositories {\n        maven {\n        name = 'Ladysnake Mods'\n        url = 'https://maven.ladysnake.org/releases'\n        content {\n            includeGroup 'io.github.ladysnake'\n            includeGroup 'org.ladysnake'\n            includeGroupByRegex 'dev\\\\.onyxstudios.*'\n        }\n    }\n}\n\ndependencies {\n    modImplementation \"org.ladysnake:satin:${satin_version}\"\n    // Include Satin as a Jar-in-Jar dependency (optional)\n    include \"org.ladysnake:satin:${satin_version}\"\n}\n```\n\nYou can then add the library version to your `gradle.properties`file:\n\n```properties\n# Satin library\nsatin_version = 2.x.y\n```\n\nYou can find the current version of Satin in the [releases](https://github.com/Ladysnake/Satin/releases) tab of the repository on Github.\n\n*If you wish your mod to be 100% standalone, you also need to include the `fabric-api-base` and `fabric-resource-loader-v0` modules from Fabric API in your mod jar.*\n\n## Using Satin\n\n### Changes to Vanilla\n\nSimply having Satin installed alters the game in a few ways, mainly related to ShaderEffects.\n\n- **Uniform fix**: Using a vector of integers as a uniform crashes the game in Vanilla because of a bad\ncopy paste. Satin redirects a call to upload the right buffer.\n- **Shader locations**: Satin patches shader processors to accept a resource domain in the specification\nof a program name and of a fragment/vertex shader file.\n- **Custom Target Formats**: Satin adds a `satin:format` property to [post-process shader JSONs](https://github.com/Ladysnake/Satin/wiki/Post-Process-Shader-format)\n  to allow shader targets to specify different formats to `RGBA8`.\n  Supported formats are `RGBA8`, `RGBA16`, `RGBA16F`, and `RGBA32F`.\n- ~~**Readable depth**~~: Satin offered access to a Framebuffer's depth texture before it was cool (superseded in 1.16).\n\nSatin **does not** set the shader in `GameRenderer`, except if a mod registers a `PickEntityShaderCallback`.\n\n### Shader Management\n\nSatin's main feature is the Shader Effect management facility. \n\n`ShaderEffect` is a Minecraft class implementing data driven post processing shaders, with a few caveats.\nFirst, those shader effects are initialized immediately at construction, but they must be initialized after the game has\nfinished loading to avoid gl errors. Then, they must be updated each time the game's resolution changes.\nFinally, they do not have any way of setting uniforms from external code.\n\nSatin can manage a shader effect for you, giving you a `ManagedShaderEffect` object.\nThis shader effect is lazily initialized - although it can be initialized manually at any time.\nInitialized shader effects will be automatically reloaded each time the game's resolution changes,\nand during resource reloading. It also provides a number of access methods to set uniforms dynamically.\n\nHere is the whole java code for a mod that applies a basic shader to the game:\n\n```java\npublic class GreyscaleMinecraft implements ClientModInitializer {\n    private static final ManagedShaderEffect GREYSCALE_SHADER = ShaderEffectManager.getInstance()\n    \t\t.manage(Identifier.of(\"shaderexample\", \"shaders/post/greyscale.json\"));\n    private static boolean enabled = true;  // can be disabled whenever you want\n    \n    @Override\n    public void onInitializeClient() {\n        // the render method of the shader will be called after the game\n        // has drawn the world on the main framebuffer, when it renders\n        // vanilla post process shaders\n    \tShaderEffectRenderCallback.EVENT.register(tickDelta -\u003e {\n    \t    if (enabled) {\n                GREYSCALE_SHADER.render(tickDelta);\n            }\n    \t});\n    }\n}\n```\n\nFor examples of json shader definitions, look for the `assets/minecraft/shaders` folder in the minecraft source (description of those shaders can be found on the [Minecraft Wiki](https://minecraft.wiki/w/Shaders)). There is also a real application of this library in [Requiem](https://github.com/Ladysnake/Requiem/blob/d95c4f5c55/src/main/java/ladysnake/requiem/client/RequiemFx.java).\n\n### RenderLayer Utilities\n\nThe `ManagedFramebuffer` and `ManagedShaderProgram` classes have methods to obtain clones of existing `RenderLayer` objects,\nwith a custom `Target`. This target causes draw calls to happen on the `ManagedFramebuffer` for the former, or using the\nshader program for the latter. This can be notably used to render custom effects on entities and block entities.\n\nFor examples of entities using those, see [the relevant test mod](https://github.com/Ladysnake/Satin/blob/master/test_mods/render-layer/src/main/java/ladysnake/satinrenderlayer/).\n\n**Regular blocks do not support custom render layers.** For advanced shader materials, you should consider using\nan alternative renderer like [Canvas](https://github.com/grondag/canvas).\n\n### Shader Utilities\n\nSatin has a few utility classes and methods to facilitate working with shaders, not limited to `ShaderEffect`. \n`ShaderLoader` provides a way to load, create and link OpenGL shader programs through a single method call, \n`GlPrograms` offer helper methods that operate on those programs, and the `matrix` package helps with matrix retrieval and manipulation. \nMore information is available in the javadoc.\n\n### Events\n\nSatin adds in a few events for rendering purposes / related to shaders. Currently, there are 5 available callbacks:\n\n- `EntitiesPostRenderCallback`: fired between entity rendering end and block entity rendering start\n- `PickEntityShaderCallback`: allows mods to add their own entity view shaders\n- `PostWorldRenderCallback`: allows mods to render things between the moment minecraft finishes rendering the world\nand the moment it starts rendering HUD's and GUI's\n- `ResolutionChangeCallback`: allows mods to react to resolution changes\n- `ShaderEffectRenderCallback`: fired at the time vanilla renders their post process shaders\n\n*Note that those events may move to a more dedicated library at some point.*\n\n## Full documentation\n\nThis [repository's wiki](https://github.com/Ladysnake/Satin/wiki) provides documentation to write and use shaders with Satin API.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fladysnake%2Fsatin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fladysnake%2Fsatin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fladysnake%2Fsatin/lists"}