{"id":13435424,"url":"https://github.com/discosultan/penumbra","last_synced_at":"2025-06-21T20:14:10.253Z","repository":{"id":48080277,"uuid":"37822381","full_name":"discosultan/penumbra","owner":"discosultan","description":"2D lighting with soft shadows for MonoGame","archived":false,"fork":false,"pushed_at":"2022-08-02T14:05:23.000Z","size":20515,"stargazers_count":331,"open_issues_count":23,"forks_count":34,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-04-24T07:49:37.260Z","etag":null,"topics":["2d-lighting","monogame"],"latest_commit_sha":null,"homepage":"","language":"C#","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/discosultan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-21T19:20:46.000Z","updated_at":"2025-04-17T07:18:11.000Z","dependencies_parsed_at":"2022-08-12T18:10:41.129Z","dependency_job_id":null,"html_url":"https://github.com/discosultan/penumbra","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/discosultan/penumbra","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discosultan%2Fpenumbra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discosultan%2Fpenumbra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discosultan%2Fpenumbra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discosultan%2Fpenumbra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/discosultan","download_url":"https://codeload.github.com/discosultan/penumbra/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discosultan%2Fpenumbra/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261186796,"owners_count":23121951,"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":["2d-lighting","monogame"],"created_at":"2024-07-31T03:00:35.593Z","updated_at":"2025-06-21T20:14:05.233Z","avatar_url":"https://github.com/discosultan.png","language":"C#","funding_links":[],"categories":["Effects"],"sub_categories":[],"readme":"## What is this sorcery?\n\nPenumbra allows users to easily add 2D lighting with shadowing effects to their games.\n\n\u003e Note that this project is no longer in development. I do try to fix any bugs though!\n\n![Platformer2D sample](Documentation/Platformer2D.jpg)\n\n- https://www.youtube.com/watch?v=L9w9mEAb9gk\u0026feature=youtu.be\n\n## Getting Started\n\n### Building source and samples\n\nThe following is required to successfully compile the Penumbra MonoGame solution:\n\n- Visual studio 2022+\n- MonoGame 3.8.1+\n- [DirectX End-User Runtimes (June 2010)](http://www.microsoft.com/en-us/download/details.aspx?id=8109) (to compile effect shaders)\n\n### Using Penumbra\n\n\u003e Currently available only for MonoGame WindowsDX platform targeting .NET 4.5+!\n\nInstall the assembly through NuGet:\n\n```powershell\nInstall-Package MonoGame.Penumbra.WindowsDX\n```\n\nIn the game constructor, create the Penumbra component and add to components:\n```cs\nPenumbraComponent penumbra;\n\npublic Game1()\n{\n  // ...\n  penumbra = new PenumbraComponent(this);\n  Components.Add(penumbra);\n}\n```\n\nIn the game's `Draw` method, make sure to call `BeginDraw` before any other drawing takes place:\n\n```cs\nprotected override void Draw(GameTime gameTime)\n{\n  penumbra.BeginDraw();\n  GraphicsDevice.Clear(Color.CornflowerBlue);\n  // Rest of the drawing calls to be affected by Penumbra ...\n}\n...\n```\n\nThis will swap the render target to a custom texture so that the generated lightmap can be blended atop of it once `PenumbraComponent` is drawn.\n\nBy default, Penumbra operates in the same coordinate space as `SpriteBatch`. Custom coordinate space can be configured by setting:\n\n```cs\npenumbra.SpriteBatchTransformEnabled = false;\n```\n\n Custom transform matrix is set through the `Transform` property.\n\n### Working with lights\n\nPenumbra supports three types of lights: `PointLight`, `Spotlight`, `TexturedLight`\n\n![PointLight](Documentation/PointLight.png)\n![Spotlight](Documentation/Spotlight.png)\n![TexturedLight](Documentation/TexturedLight.png)\n\nWhile `PointLight` and `Spotlight` are generated on the shader, `TexturedLight` allows for more customization by requiring a custom texture used for lighting.\n\nLights provide three types of shadowing schemes: `ShadowType.Solid`, `ShadowType.Occluded`, `ShadowType.Illuminated`\n\n![Solid](Documentation/Solid.png)\n![Occluded](Documentation/Occluded.png)\n![Illuminated](Documentation/Illuminated.png)\n\nTo add a light:\n\n```cs\npenumbra.Lights.Add(light);\n```\n\n### Working with shadow hulls\n\nHulls are polygons from which shadows are cast. They are usually created using the same geometry as the scene and can be ordered both clockwise or counter-clockwise. Hull points can be manipulated through the `hull.Points` property.\n\nFor a hull to be valid and included in the shadow mask generation, it must conform to the following rules:\n\n- Contain at least 3 points\n- Points must form a simple polygon (polygon where no two edges intersect)\n\nHull validity can be checked through the `hull.Valid` property.\n\nTo add a hull:\n\n```cs\npenumbra.Hulls.Add(hull);\n```\n\n## Assemblies\n\n- **MonoGame.Penumbra**: The core project for the lighting system.\n\n## Samples\n\n- **HelloPenumbra**: Simple sample which sets up bare basics of Penumbra with a single light source and shadow hull.\n- **Platformer2D**: Penumbra lighting applied to [MonoGame Platformer2D samples game](https://github.com/MonoGame/MonoGame.Samples).\n- **Sandbox**: Generic sandbox for testing out various different scenarios.\n- **Common**: Supporting library providing common functionality for samples.\n- **[FarseerPhysics](https://github.com/discosultan/penumbra/tree/master/Samples/FarseerPhysics)**: Create physical bodies out of sprites and add them as hulls to Penumbra!\n\n## Development\n\n### Release a New Version\n\n* Make sure version numbers are updated in .csproj files.\n* Create packages:\n\n```sh\ndotnet pack -c Release MonoGame.Penumbra.DesktopGL.sln\ndotnet pack -c Release MonoGame.Penumbra.WindowsDX.sln\n```\n\n* Publish packages (substitute `\u003cversion\u003e` with version to be released):\n\n```sh\nVERSION=\u003cversion\u003e\ndotnet nuget push Source/bin/Release/MonoGame.Penumbra.DesktopGL.$VERSION.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json\ndotnet nuget push Source/bin/Release/MonoGame.Penumbra.WindowsDX.$VERSION.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiscosultan%2Fpenumbra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiscosultan%2Fpenumbra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiscosultan%2Fpenumbra/lists"}